[Numpy-discussion] (Late) summary of PEP-225 discussion at Scipy
David Warde-Farley
dwf at cs.toronto.edu
Mon Oct 27 09:09:44 EDT 2008
On 27-Oct-08, at 7:22 AM, James Philbin wrote:
> One operator which could be used is '%'. We could keep the current
> behaviour for ARRAY%SCALAR but have ARRAY%ARRAY as being matrix
> multiplication. It has the same precedence as *,/.
The problem is that it would monkey with existing semantics for
broadcasting, and break with all the other arithmetic operators in
this regard. I can't see it ever being accepted for that reason.
Example:
In [514]: x
Out[514]:
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
In [515]: y
Out[515]: array([0, 1, 2])
In [516]: x % y
Out[516]:
array([[0, 0, 0],
[0, 0, 1],
[0, 0, 0]])
David
More information about the NumPy-Discussion
mailing list