Python issubclass() Function

Example

Check if myObj is a subclass of myAge:

class myAge:
  age = 63
class myObj(myAge):
  name = "Bill"
  age = myAge
x = issubclass(myObj, myAge)

Running an Instance

Definition and Usage

issubclass() If the specified object is a subclass of the specified object, the issubclass() function will return True, otherwise it will return False.

Syntax

issubclass(object, subclass)

Parameter Value

Parameter Description
object Required. Object.
subclass class object, or a tuple of class objects.

Related Pages

Reference Manual:isinstance() Function(Check if the object is of a specific type)