March 2003
Intermediate to advanced
656 pages
39h 30m
English
isinstance
isinstance(obj,cls)
Returns True when obj
is an instance of class cls (or any
subclass of cls) or when
cls is a type object and
obj is an object of that type. Otherwise
it returns False.
Since Python 2.2.1, cls can also be a
tuple whose items are classes or types. In this case,
isinstance returns True if
obj is an instance of any of the items of
tuple cls, otherwise
isinstance returns False.