[Numpy-discussion] Using issubdtype to check integer types

Robert Kern robert.kern at gmail.com
Thu Oct 14 11:18:26 EDT 2010


2010/10/14 Stéfan van der Walt <stefan at sun.ac.za>:
> Hi all,
>
> Is this behaviour correct?
>
> In [18]: np.issubdtype(np.uint16, np.uint)
> Out[18]: False

Yes, it's correct. np.uint is a concrete type that is the
platform-specific C unsigned long type:

|1> np.uint
<type 'numpy.uint32'>


The abstract base type is np.unsignedinteger:

|3> np.issubdtype(np.uint16, np.unsignedinteger)
True

-- 
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