[Numpy-discussion] (Late) summary of PEP-225 discussion at Scipy

David Warde-Farley dwf@cs.toronto....
Mon Oct 27 08:09:44 CDT 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