Figuring out an object's type

Courageous jkraska1 at
Wed May 10 03:11:27 CEST 2000

David Arnold wrote:
> -->"David" == David Allen <s2mdalle at> writes:
>   David> How can a python programmer figure out the type of an object?
> the type() function returns the type.  if the object is a class
> instance, then it has an attribute __class__ that can be used to
> determine its class.


import types


if type(i) == types.IntType:  print "I am an int"

More information about the Python-list mailing list