[Python-ideas] [RFC] draft PEP: Dedicated infix operators for matrix multiplication and matrix power

Steven D'Aprano steve at pearwood.info
Sat Mar 15 08:35:09 CET 2014


On Fri, Mar 14, 2014 at 09:09:02PM -0700, Bruce Leban wrote:
> I think making @ right associative would make this less suitable for other
> uses. Example
> 
> someclassobject @ somevalue @ somevalue
> 
> won't work with right-associativity. 

Why not? It works with the other right-associative operator:

    x**y**z

"Works" depends on what you expect it to do. Unless you tell us what 
these "other uses" are, how can we know that right-associativity won't 
work?


> Plus precedence of mixing right and left can be confusing.

Perhaps. Perhaps not. This works as expected:

    3*2**5


Are there any other right-associative operators that are confusing?


-- 
Steven


More information about the Python-ideas mailing list