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

Jaime Fernández del Río jaime.frio at gmail.com
Sat Mar 15 01:49:28 EDT 2014


On Fri, Mar 14, 2014 at 9:15 PM, Chris Laumann <chris.laumann at gmail.com>wrote:

> Hi all,
>
> Let me preface my two cents by saying that I think the best part of @
> being accepted is the potential for deprecating the matrix class -- the
> syntactic beauty of infix for matrix multiply is a nice side effect IMHO :)
> This may be why my basic attitude is:
>
> I don't think it matters very much but I would vote (weakly) for
> weak-right. Where there is ambiguity, I suspect most practitioners will
> just put in parentheses anyway -- especially with combinations of * and @,
> where I don't think there is a natural intuitive precedence relationship.
>
At least, element-wise multiplication is very rare in math/physics texts as
> an explicitly defined elementary operation so I'd be surprised if anybody
> had a strong intuition about the precedence of the '*' operator.
>

My take on this is that if you mix * and @, you are probably using * to
build the matrices you want to __matmul__ with @. So weak-right would be
the way to go from that point of view.

 Jaime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140314/5b3f826b/attachment.html>


More information about the NumPy-Discussion mailing list