How will you check in Python, if a class is subclass of another class?

Python provides a useful method issubclass(a,b) to check whether class a is a subclass of b.

E.g. int is not a subclass of long
>>> issubclass(int,long)

bool is a subclass of int
>>> issubclass(bool,int)

Leave a Reply

Your email address will not be published. Required fields are marked *