There has been lots of conversation recently on adding an infix matrix multiplication operator to Python, pushed by some folks from the numpy/scipy community, and backed by pandas and some other projects. Guido has practically accepted the proposal to make @ an infix matrix multiplication operator (like A @ B). There are ongoing conversations about operator precedence, binding, etc., as well as the possibility of a matrix power operator @@ (like A @@ 2).

Anyways, see the message below from Nathaniel, who has been the one spearheading this.

Thanks,

Jason

-------- Original Message --------
Subject: [pydata] Re: A PEP for adding infix matrix multiply to Python
Date: Sun, 16 Mar 2014 02:40:11 +0000
From: Nathaniel Smith <n...@pobox.com>
Reply-To: pyd...@googlegroups.com
To: pyd...@googlegroups.com

Hi again,

As an update on this for anyone not following python-ideas or
numpy-discussion: Guido has accepted the addition of @ as a matrix
multiplication operator in principle, once some details are worked
out:
    https://mail.python.org/pipermail/python-ideas/2014-March/027109.html

So if you have any feedback you've been sitting on, now is a good time
to speak up :-). The current PEP draft can be seen here:
    http://legacy.python.org/dev/peps/pep-0465/

I've also started threads on numpy-discussion specifically about the
details to be worked out, in case anyone wants to comment -- input on
these points would be especially helpful:

Precedence/associativity of @:
http://mail.scipy.org/pipermail/numpy-discussion/2014-March/069444.html

Do we care about @@:
http://mail.scipy.org/pipermail/numpy-discussion/2014-March/069448.html

I believe that if you aren't subscribed to numpy-discussion, then you
can still post through gmane (though unfortunately their anti-spam
munging of the @ character makes these threads kind of hard to read!):
http://news.gmane.org/gmane.comp.python.numeric.general

Or, worst case, just email me directly, and I'll collate.

Cheers,
-n

On Sat, Feb 22, 2014 at 10:00 PM, Nathaniel Smith <n...@pobox.com> wrote:
[Apologies for wide distribution -- please direct followups to either
the github PR linked below, or else numpy-discuss...@scipy.org]

After the numpy-discussion thread about np.matrix a week or so back, I
got curious and read the old PEPs that attempted to add better
matrix/elementwise operators to Python.
  http://legacy.python.org/dev/peps/pep-0211/
  http://legacy.python.org/dev/peps/pep-0225/
And I was a bit surprised -- if I were BDFL I probably would have
rejected these PEPs too. One is actually a proposal to make
itertools.product into an infix operator, which no-one would consider
seriously on its own merits. And the other adds a whole pile of
weirdly spelled new operators with no clear idea about what they
should do.

But it seems to me that at this point, with the benefit of multiple
years more experience, we know much better what we want -- basically,
just a nice clean infix op for matrix multiplication. And that just
asking for this directly, and explaining clearly why we want it, is
something that hasn't been tried. So maybe we should try and see what
happens.

As a starting point for discussion, I wrote a draft. It can be read
and commented on here:
   https://github.com/numpy/numpy/pull/4351

It's important that if we're going to do this at all, we do it right,
and that means being able to honestly say that this document
represents our consensus when going to python-dev. So if you think you
might object please do so now :-)

-n

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



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

--
You received this message because you are subscribed to the Google Groups "PyData" group. To unsubscribe from this group and stop receiving emails from it, send an email to pydata+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to