On Sat, Feb 22, 2014 at 7:09 PM, Pauli Virtanen <p...@iki.fi> wrote: > 23.02.2014 00:03, Nathaniel Smith kirjoitti: >> Currently numpy's 'dot' acts a bit weird for ndim>2 or ndim<1. In >> practice this doesn't usually matter much, because these are very >> rarely used. But, I would like to nail down the behaviour so we can >> say something precise in the matrix multiplication PEP. > > I'm not sure it's necessary to say much about this in the PEP. It should > in my view concentrate on arguing why the new binop is needed in the > Python language, and for that, restricting to 2D is good enough IMHO. > > How exactly Numpy makes use of the capability for > 2-dim arrays is > something that should definitely be discussed. > > But I think this is a problem mainly interesting for Numpy devs, and not > for CPython devs.
I actually disagree strongly. I think it's very important to make clear that we have a clear, well thought through, and cross-project approach to what @ is supposed to mean, so that this doesn't come across as numpy asking python-dev for a blank check to go and define the de facto semantics of a new operator just for ourselves and without any adult supervision. I just don't think they trust us that much. (Honestly I probably wouldn't either in their place). It's true that the higher-dim cases aren't the most central ones, but it can't hurt to document all the details. I've tentatively rewritten the first section of the PEP to try and accomplish this framing: https://github.com/njsmith/numpy/blob/matmul-pep/doc/neps/return-of-revenge-of-matmul-pep.rst Comments welcome etc. Also BTW in the process I discovered another reason why broadcasting is better than the outer product semantics -- with broadcasting, writing down matrix power for >2d is trivial and natural, but with the outer product semantics, it's practically impossible! -n -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion