Web Analytics

Python isinstance() Function

Built-in Function Introspection

The isinstance() function returns True if the specified object is of the specified type, otherwise False.

This function also returns True if the object is an instance of a subclass of the specified class.

Syntax

isinstance(object, type)

Parameters

Parameter Description
object Required. The object to check
type Required. A class, type, or a tuple of classes and types

Return Value

Boolean. True if the object is an instance of the type, otherwise False.

Example

Using the isinstance() function:

Output
Click Run to execute your code

Related Functions