[Numpy-discussion] possible bug: __array_wrap__ is not called during arithmetic operations in some cases
Sun Feb 22 16:51:33 CST 2009
Does anyone know why __array_wrap__ is not called for subclasses during
arithmetic operations where an iterable like a list or tuple appears to the
right of the subclass? When I do "mine*[1,2,3]", array_wrap is not called
and I get an ndarray instead of a MyArray. "[1,2,3]*mine" is fine, as is
"mine*array([1,2,3])". I see the same issue with division, addition, etc.
Here is a demonstration, observed with svn 6456:
import numpy as np
__array_priority__ = 20
def __array_wrap__(self, obj, context=None):
print 'array wrap:', self, obj, context
mine = MyArray()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion