[Numpy-discussion] Using issubdtype to check integer types

Robert Kern robert.kern@gmail....
Thu Oct 14 10:18:26 CDT 2010


2010/10/14 Stéfan van der Walt <stefan@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