[Python-Dev] Matrix product
Guido van Rossum
guido at python.org
Wed Jul 30 02:26:59 CEST 2008
On Fri, Jul 25, 2008 at 6:50 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Sebastien Loisel wrote:
>
>> What are the odds of this thing going in?
>
> I don't know. Guido has said nothing about it so far this
> time round, and his is the only opinion that matters in the
> end.
I'd rather stay silent until a PEP exists, but I should point out that
last time '@' was considered as a new operator, that character had no
uses in the language at all. Now it is the decorator marker. Therefore
it may not be so attractive any more.
I understand that you can't use A*B as matrix multiplication because
it should mean elementwise multiplication instead, just like A+B is
elementwise addition (for matrixes, as opposed to Python sequences).
But would it be totally outlandish to propose A**B for matrix
multiplication? I can't think of what "matrix exponentiation" would
mean...
--Guido
> I may write a PEP about this. However, since yesterday I've
> realised that there's a rather serious problem with part
> of my proposal.
>
> The problem is that being able to multiply matrices isn't
> much use without also being able to add them and multiply
> them by numbers, which obviously can't work with the
> built-in sequence types, since they already have other
> meanings for + and *.
>
> However, I still think that adding an @ operator for numpy
> to use is a good idea. So I'm now suggesting that the
> operator be added, with the intended meaning of matrix
> multiplication, but that no implementation of it be
> provided in core Python.
>
> There is a precedent for this -- the ellipsis notation was
> added purely for use by Numeric and its successors, and
> nothing in core Python attaches any meaning to it.
>
>> How do the PEPs work?
>
> Someone writes a PEP. People talk about it. Eventually, Guido
> either accepts it or rejects it (although in some cases it
> is an infinitely long time before that happens:-).
>
> --
> Greg
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list