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

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Mar 14 17:40:15 CET 2014


On Fri, Mar 14, 2014 at 12:20 PM, Nathaniel Smith <njs at pobox.com> wrote:

> >>< (for multiplication, not sure about exponentiation.  I only like it
> because it's the shortest thing I've come up with that looks somewhat like
> multiplication)
> > [*] / [**] ([] make me think 'matrix', but this might be confusing to
> > the parser)
> > |*| / |**| (pretty close to [], shouldn't confuse the parser)
>
> I really liked the [*] or |*| "footnote operator" idea, and got all
> excited, until I tried it :-).


+1

Consider this:

A[*](B+C)

vs.

A[0]*(B+C)

the former looks like that later fat-fingered.

Given that in numpy it is no uncommon to have ":", ":,:", "...", or even
"()" to go inside [], [*] is more likely to be interpreted by those who
first see it as some new form of fancy indexing rather than matrix
multiplication.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140314/fecf6b1d/attachment.html>


More information about the Python-ideas mailing list