Documentation

Function defined in library builtins

isinstance(object, class)

isinstanceobjectclass

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 otherwise
Code
isinstance(42, int)
Result
True
Code
isinstance(42, str)
Result
False
Code
isinstance(red, Color)
Result
True

See also isinstance in the official documentation

PyTamaro logo

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy Policy • Platform Version c67fb165 (October 16, 2026 at 2:45:13 PM UTC)