[SciPy-User] Integer dtype comparisons

Robert Kern robert.kern at gmail.com
Wed Sep 22 10:37:21 EDT 2010


On Wed, Sep 22, 2010 at 07:07, Flipper <flip-per at pimmer.info> wrote:
> Hello,
>
> is there a nice way to check whether an object is an Integer? Including
> all python and numpy Integers?
>
> I tried out subclass, but uint is not a subclass of Int:
>
>>>> a = numpy.zeros(1,numpy.uint32)
>>>> aType = type(a[0])
>>>> issubclass(aType,types.IntType)
> False

isinstance(a[0], (int, numpy.integer))

-- 
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 SciPy-User mailing list