[Numpy-discussion] user_array.container and __eq__ [was: Re: (no subject)]
robert.kern at gmail.com
Sun Sep 3 00:10:47 CDT 2006
Bill Spotz wrote:
> I think I see a bug in lib.user_array.container class. The __eq__
> method is
> def __eq__(self,other): return self._rc(equal(self.array,other))
> the expression equal(self.array,other) will return an ndarray of
> bools, which is then converted, by way of self._rc(), to whatever the
> derived class is. In my case, this does not make sense, because an
> array of bools is not a valid argument to the constructor (actually,
> the data buffer is accepted, but the results are not reliable). What
> I want, and it seem most people would want in this situation, is just
> the array of bools; i.e. don't apply the self._rc() method.
No, it's not a bug. It's just the design of that class: always return the same
class of object. Of course, since that class only exists to be subclassed, if
you need different behavior from those methods, override them.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion