[Numpy-discussion] (no subject)

Bill Spotz wfspotz at sandia.gov
Sat Sep 2 23:47:55 CDT 2006

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.

Assuming there is agreement that this is the desirable behavior, the  
same would be true for __lt__, __le__, etc.

I will probably override this behavior by defining my own __eq__,  
etc., in my derived class, just for safety.

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-5451      **
** Albuquerque, NM 87185-0370    Email: wfspotz at sandia.gov **

More information about the Numpy-discussion mailing list