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

Nathaniel Smith njs at pobox.com
Thu Mar 20 10:02:53 EDT 2014


On Thu, Mar 20, 2014 at 9:07 AM, Robert Kern <robert.kern at gmail.com> wrote:
> I think the operator-overload-as-DSL use cases actually argue somewhat
> for right-associativity. There is no lack of left-associative
> operators for these use cases to choose from since they usually don't
> have numeric or bitwise operations defined for them.
> Right-associativity adds some diversity into the ecosystem and opens
> up some design space.

Whether or not this is true, I think we should assign this argument
~zero weight for purposes of the present discussion. That's because:
- We haven't been asked to figure out the best design of @ for Python
overall, we've been asked to report back on what design of @ will be
best for the numeric community, since that's where we have special
expertise that python-dev lacks. Python-dev is entirely capable of
then taking our report as input and then having a debate about how
much weight to give to these other possible uses.

- And anyway, my impression is that python-dev will give these other
possible uses ~zero weight anyway -- if they thought random DSL
operators were important for their own sake, they would have added @
long ago :-). Maybe if we say "we literally do not care at all what
@'s precedence and associativity are", then it will matter as a
tie-breaker, but first I don't think it's true that we don't care, and
second even if it were then my guess is that the argument for
consistency with the other operators would be a stronger tie-breaker.

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org



More information about the NumPy-Discussion mailing list