> On 3 Feb 2019, at 21:34, David Mertz <[email protected]> wrote:
> 
> On Sun, Feb 3, 2019 at 3:16 PM Ronald Oussoren <[email protected] 
> <mailto:[email protected]>> wrote:
> The @ operator is meant for matrix multiplication (see PEP 465) and is 
> already used for that in NumPy. IMHO just that is a good enough reason for 
> not using @ as an elementwise application operator (ignoring if having an 
> such an operator is a good idea in the first place).
> 
> Co-opting operators is pretty common in Python.  For example, the 
> `.__div__()` operator spelled '/' is most often used for some kind of numeric 
> division.  Some variations on that, for example vectorized in NumPy.  And 
> different numeric types operate a bit differently.  The name of the magic 
> method obvious suggests division.

I know, but if an element-wise operator is useful it would also be useful for 
libraries like NumPy that already support the @ operator for matrix 
multiplication.  Using @ both for matrix multiplication and element-wise 
application could be made to work, but would be very confusing. 
 
Ronald

—

Twitter: @ronaldoussoren
Blog: https://blog.ronaldoussoren.net/
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to