On 3 Feb 2019, at 21:34, David Mertz firstname.lastname@example.org wrote:
On Sun, Feb 3, 2019 at 3:16 PM Ronald Oussoren <email@example.com mailto:firstname.lastname@example.org> 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.
Twitter: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/