Built-in Functions
issubclass()
Check whether one class inherits from another.
issubclass(class, classinfo)
issubclass() works with classes, not ordinary object values. It returns true when the first class is the same as or inherits from the second class.
Arguments
Parameters
| Name | Description |
|---|---|
| class | The class to test. |
| classinfo | A class or tuple of classes to compare against. |
Result
Returns
True if the class inherits from or matches classinfo; otherwise False.
Run it
Try it
Run it and change it
class Dog:
pass
print(issubclass(Dog, object)) Output
Press Run to see what it prints.