[Numpy-discussion] [help needed] associativity and precedence of '@'

Robert Kern robert.kern at gmail.com
Tue Mar 18 05:14:18 EDT 2014


On Tue, Mar 18, 2014 at 12:54 AM, Nathaniel Smith <njs at pobox.com> wrote:
> On Sat, Mar 15, 2014 at 6:28 PM, Nathaniel Smith <njs at pobox.com> wrote:
>> Mathematica: instead of having an associativity, a @ b @ c gets
>> converted into mdot([a, b, c])
>
> So, I've been thinking about this (thanks to @rfateman for pointing it
> out), and wondering if Mathematica's approach is worth following up
> more. (It would need to make it past python-dev, of course, but worst
> case is just that they say no and we're back where we are now, so we
> might as well think it through.)

I predict with near-certainty that this will be rejected, but that
doesn't prevent it from derailing the discussion. This proposal is
unlike anything else in Python. Chained comparisons are *not* similar
to this proposal. The chaining only happens at the syntax level, not
the semantics. `a < b < c` gets compiled down to `a.__lt__(b) and
b.__lt__(c)`, not `do_comparison([a, b, c], [lt, lt])`.

We have approval for a binary @ operator. Take the win.

-- 
Robert Kern



More information about the NumPy-Discussion mailing list