[Numpy-discussion] Re: dtype: hashing and cmp
Travis Oliphant
oliphant.travis at ieee.org
Sun May 28 13:38:01 EDT 2006
Simon Burton wrote:
> On Sun, 28 May 2006 14:33:37 -0500
> Robert Kern <robert.kern at gmail.com> wrote:
>
>
>>> if array.dtype == numpy.Int32: ...
>>>
>> numpy.int32
>>
>
>
> No that doesn't work.
>
>
Yeah, the "canonical" types (e.g. int32, float64, etc) are actually
scalar objects. The type objects themselves are dtype(int32). I don't
think they are currently listed anywhere in Python (except there is one
for every canonical scalar object). The difference between the scalar
object and the data-type object did not become clear until December
2005. Previously the scalar object was used as the data-type
(obviously there is still a relationship between them).
-Travis
>>>> numpy.int32
>>>>
> <type 'int32scalar'>
>
>>>> numpy.int32 == numpy.dtype('l')
>>>>
> False
>
>
> Simon.
>
>
More information about the NumPy-Discussion
mailing list