Isinstance function

The isinstance function in Python checks whether or not a given object is an instance of a given class. This is sometimes useful because Python is dynamically typed, so the class of object stored in a variable may not be known until runtime. It has the following syntax:

isinstance(object, Class)

It will return True if object is an instance of Class or a subclass of Class, and False otherwise.

See Also

Python 3.2 Documentation