[Numpy-discussion] Is this a bug?
Travis E. Oliphant
Fri May 30 21:24:08 CDT 2008
Robert Kern wrote:
> On Wed, May 28, 2008 at 7:52 PM, Travis E. Oliphant
> <firstname.lastname@example.org> wrote:
>> Anne Archibald wrote:
>>> 2008/5/27 Robert Kern <email@example.com>:
>>>> Can we make it so that dtype('c') is preserved instead of displaying
>>>> '|S1'? It does not behave the same as dtype('|S1') although it
>>>> compares equal to it.
>>> It seems alarming to me that they should compare equal but behave
>>> differently. Is it possible to change more than just the way it
>> comparison on dtype objects is about memory layout equivalency.
>> Characters and length-1 strings are equivalent from a memory-layout
> That would be fine if dtypes only represented memory layout. However,
> in this case, they also represent a difference in interpretation of
> str objects in the array() constructor. That is a real difference that
> needs to be reflected in __eq__ and __repr__.
I think __repr__ can be changed without trouble. I'm concerned about
changing __eq__, however.
More information about the Numpy-discussion