isinstance(object, class)
Returns True if an object is an instance of a class (or one of its subclasses).
objectobject to check
classclass to check against
True if the object is an instance of the class (or one of its subclasses), False otherwiseisinstance(42, int)True
isinstance(42, str)False
isinstance(red, Color)True

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version 2d6761d1 (November 18, 2026 at 2:38:32 PM UTC)