[Numpy-discussion] __array_priority__ ignored if __array__ is present

2013-05-16 Thread Thomas Robitaille
Hi everyone, (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 class TestClass(object): d

Re: [Numpy-discussion] __array_priority__ ignored if __array__ is present

2013-05-16 Thread Frédéric Bastien
I looked yesterday rapidly in the code and didn't find the reason (I don't know it well, that is probably why). But last night I think of one possible cause. I found this code 2 times in the file core/src/umath/ufunc_object.c: if (nin == 2 && nout == 1 && dtypes[1]->type_num == NPY_OBJECT) {

Re: [Numpy-discussion] __array_priority__ ignored if __array__ is present

2013-05-30 Thread Thomas Robitaille
Hi Frederic, On 16 May 2013 15:58, Frédéric Bastien wrote: > I looked yesterday rapidly in the code and didn't find the reason (I don't > know it well, that is probably why). > > But last night I think of one possible cause. I found this code 2 times in > the file core/src/umath/ufunc_object.c: >

Re: [Numpy-discussion] __array_priority__ ignored if __array__ is present

2013-05-30 Thread Frédéric Bastien
I think so. Changing the order between "np.array([1,2,3]) * a" and "a * np.array([1,2,3])" should return the same type I think, specificaly when array_priority is defined. Fred On Thu, May 30, 2013 at 3:28 PM, Thomas Robitaille < thomas.robitai...@gmail.com> wrote: > Hi Frederic, > > On 16 May