Re: [Numpy-discussion] Overload binary operators with custo m array type

2007-01-12 Thread Adam Jenkins
Travis Oliphant ieee.org> writes: > > Adam Jenkins wrote: > > I just tried it, and it does solve the problem for the > > mathematical operators like + and -, but doesn't seem to work for > > the comparison operators. That is, if I write > > > > lhs

Re: [Numpy-discussion] Overload binary operators with custo m array type

2007-01-12 Thread Adam Jenkins
Timothy Hochberg ieee.org> writes: > You want __array_priority__; add an attribute __array_priority__ to your array-like object and set it's value to, say, 10 and ndarrays will defer to your object. Thank you very much. I had seen the __array_priority__ property mentioned in the Numpybook, but i

[Numpy-discussion] Overload binary operators with custom array type

2007-01-12 Thread Adam Jenkins
I have written my own array class, let's call it "myarray", which behaves like a numpy.ndarray. I would like to support binary operators with mixed operand types, i.e.: lhs + rhs where one of the operands is a myarray object, and the other is a numpy.ndarray object. The problem is that I want