[Numpy-discussion] __array_priority__ ignored if __array__ is present
thomas.robitaille at gmail.com
Thu May 16 09:19:51 EDT 2013
(this was posted as part of another topic, but since it was unrelated,
I'm reposting as a separate thread)
I've also been having issues with __array_priority__ - the following
code behaves differently for __mul__ and __rmul__:
import numpy as np
def __init__(self, input_array):
self.array = input_array
def __mul__(self, other):
print "Called __mul__"
def __rmul__(self, other):
print "Called __rmul__"
def __array_wrap__(self, out_arr, context=None):
print "Called __array_wrap__"
print "Called __array__"
In : a = TestClass([1,2,3])
In : print type(np.array([1,2,3]) * a)
In : print type(a * np.array([1,2,3]))
Is this also an oversight? I opened a ticket for it a little while ago:
More information about the NumPy-Discussion