Function Details: isinstance

Description


Returns whether an object is an instance of a class or of a subclass thereof.


Extended Description


The isinstance() function checks if the first argument is an instance or subclass of the second argument. If the second argument is a tuple of classes or types, it checks if the first argument is an instance of any of those classes or types.


Read More about isinstance from Python Documentation

Function Signature


isinstance(object: Any, classinfo: Union[type, Tuple[type, ...]]) -> bool

Module: builtins

Parameters



Parameter List


  • object: Any
  • classinfo: Union[type, Tuple[type, ...]]

Return


Returns a boolean indicating whether the object is an instance of the specified class(es) or type(s).


Return Type


bool

Output

Explanation

This example shows basic usage of isinstance() with different types.