[Numpy-discussion] int32 twice in sctypes?

Robert Kern robert.kern at gmail.com
Tue Nov 28 17:20:53 CST 2006


Matthew Brett wrote:
> Hi,
> 
> I was a bit confused by this on 32 bit linux:
> 
> In [30]:sctypes['int']
> Out[30]:
> [<type 'numpy.int8'>,
>  <type 'numpy.int16'>,
>  <type 'numpy.int32'>,
>  <type 'numpy.int64'>,
>  <type 'numpy.int32'>]
> 
> Is it easy to explain the two entries for int32 here?  I notice there
> is only one int32 entry for the same test on my 64 bit system.

Hmm. When we construct that dictionary, we put in all of the explicit integer
types (8, 16, 32, 64), and then add the "pointer"-width integer if it's not
already there. However, at least on my machine and yours, the actual scalar type
objects are different (although they represent the same information).


In [38]: import numpy

In [39]: id(numpy.dtype('p').type)
Out[39]: 62091392

In [40]: id(numpy.int32)
Out[40]: 62091200


I'm not entirely sure why this is.

-- 
Robert Kern

"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 mailing list