On Tue, Apr 1, 2014 at 4:13 PM, Charles R Harris <[email protected]> wrote: > > > > On Mon, Mar 24, 2014 at 6:33 PM, Nathaniel Smith <[email protected]> wrote: >> >> On Mon, Mar 24, 2014 at 11:58 PM, Charles R Harris >> <[email protected]> wrote: >> > On Mon, Mar 24, 2014 at 5:56 PM, Nathaniel Smith <[email protected]> wrote: >> >> >> >> On Sat, Mar 22, 2014 at 6:13 PM, Nathaniel Smith <[email protected]> wrote: >> >> > After 88 emails we don't have a conclusion in the other thread (see >> >> > [1] for background). But we have to come to some conclusion or >> >> > another >> >> > if we want @ to exist :-). So I'll summarize where the discussion >> >> > stands and let's see if we can find some way to resolve this. >> >> >> >> Response in this thread so far seems (AFAICT) to have pretty much >> >> converged on same-left. >> >> >> >> If you think that this would be terrible and there is some compelling >> >> argument against it, then please speak up! Otherwise, if no-one >> >> objects, then I'll go ahead in the next few days and put same-left >> >> into the PEP. >> > >> > >> > I think we should take a close look at broadcasting before deciding on >> > the >> > precedence. >> >> Can you elaborate? Like what, concretely, do you think we need to do now? >> > > Mostly I like to think of the '@' operators like commas in a function call > where each argument gets evaluated before the matrix multiplications take > place, so that would put it of lower precedence than '*', but still higher > than '+, -' . However, since most matrix expressions seem to be small it may > not matter much and the same result could be gotten with parenthesis. But I > do think it would make it easier to read and parse matrix expressions as the > '@' would serve as a natural divider. So 'A @ B*v' would be equivalent to 'A > @ (B*v)' and not '(A @B)*v'. > > Hmm, now that I stare at it, it may actually be easier to simply read left > to right and use parenthesis when needed. So put me down as neutral at this > point and maybe trending towards equal precedence.
Okay, I'm going to let that be the last word on this (unless someone wants a laster word, but no-one seems too eager at this point). We have to pick something, we seem to have mostly converged on left-associativity, and the bulk of the opinion on left-associativity is clearly for same-left, so I've updated the PEP to include @ parsing as same-left: https://github.com/njsmith/numpy/blob/matmul-pep/doc/neps/return-of-revenge-of-matmul-pep.rst#precedence-and-associativity Thanks everyone for your feedback, both here and throughout the process in general -- I know this has been a long discussion to slog through! -n -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
