[Numpy-discussion] __eq__ method for recarray returns recarray
Fri Jul 3 21:40:19 CDT 2009
If I have two recarrays with the same len and column headers, the __eq__
method returns the rich comparison, which is great. E.g.
In : x =
In : y =
In : x == y
Out: rec.array([ True, True, True, True], dtype=bool)
But notice that the returned object is a recarray, not an array of bools.
Why is this, and what is the purpose of having it this way?
Similarly, if I subclass recarray, and say, in my subclass attach some
attributes to x, then these attributes are attached to the result of the
rich comparison. E.g. suppose I have a subclass of recarray called
"NewRecarray" to which I attach an attribute .info. Then
x = NewRecarray(data)
y = NewRecarray(data)
z = x == y
Then z is a NewRecarray object and z.info = x.info.
Is this the expected / proper behavior? Is there something wrong with the
way I've subclassed recarray?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion