Python issubclass() built-in function

From the Python 3 documentation

Return True if class is a subclass (direct, indirect, or virtual) of classinfo. A class is considered a subclass of itself. classinfo may be a tuple of class objects (or recursively, other such tuples) or a Union Type, in which case return True if class is a subclass of any entry in classinfo. In any other case, a TypeError exception is raised.


class First:

class Second(First):

print(issubclass(Second, First))  # True
print(issubclass(First, Second)) # False

Subscribe to

Join 10.700+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.