This issubclass()
function returns a Bool type indicating whether an object is a subclass of a class.
issubclass(object, classinfo)
Here,
Note: A class is considered a subclass of itself. classinfo may be a tuple of class objects, in which case every entry in classinfo will be checked. In any other case, a TypeError
exception is raised*.***
>>> class Class1:
... pass
...
>>> class Class2(Class1):
... pass
...
>>> class Class3:
... pass
...
>>> a = Class2()
>>> issubclass(Class2, Class1)
True
>>> issubclass(Class2, Class3)
False
>>> issubclass(Class1, Class1)
True
>>> issubclass(Class2, (Class1, Class3))
True