Re: [Numpy-discussion] Array subclassing - question for Travis

2008-08-28 Thread Matthew Brett
Hi Stefan, Thanks for the kindly reply... Since both those objects have an __array_priority__ of 0.0, I guess it just takes whichever class comes first. In [15]: class A(np.ndarray): : __array_priority__ = -1.0 I think, playing more... For np.multiply, it does not seem possible

Re: [Numpy-discussion] Array subclassing - question for Travis

2008-08-28 Thread Stéfan van der Walt
2008/8/28 Matthew Brett [EMAIL PROTECTED]: np.multiply.outer, always returns an ndarray type, regardless of the subtypes it is passed. Sorry, I don't know what I was thinking. You are right! Cheers Stéfan ___ Numpy-discussion mailing list

[Numpy-discussion] Array subclassing - question for Travis

2008-08-27 Thread Matthew Brett
Hi Travis and team, I am just writing some docs for subclassing, and ran into some behavior I didn't understand: In [143]: class A(np.ndarray): pass In [144]: arr = np.arange(5) In [145]: obj = arr.copy().view(A) In [146]: type(obj) Out[146]: class '__main__.A' In [147]:

Re: [Numpy-discussion] Array subclassing - question for Travis

2008-08-27 Thread Stéfan van der Walt
Hey Matthew 2008/8/27 Matthew Brett [EMAIL PROTECTED]: In [148]: type(np.multiply(arr, obj)) # this is what I expected Out[148]: class '__main__.A' In [149]: type(np.multiply.outer(arr, obj)) # this is not - I expected class A again Out[149]: type 'numpy.ndarray' Since both those objects