List replication operator

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri May 25 22:25:07 EDT 2018


bartc wrote:
> /The/ matrix multiplication operator?
> 
> In which language? And what was wrong with "*"?

It seems you're unaware that Python *already* has an '@'
operator. It was added specifically so that numpy could
use it for matrix multiplication. A new operator was
needed because numpy already uses '*' for elementwise
multiplication.

So, the issue with @ being mistakenly marked up already
exists.

> (I've implemented matrix multiply in a language (although for 
> specialised matrix types), and I used the same "*" symbol as was used to 
> multiply anything else.)

Before '@' was added, numpy did this as well, but it
was a pain to have to use a whole different type just to
get one operator to behave differently. Painful enough
that Guido was eventually persuaded to add a new operator.

-- 
Greg



More information about the Python-list mailing list