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)
False
bool is a subclass of int
>>> issubclass(bool,int)
True
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)
False
bool is a subclass of int
>>> issubclass(bool,int)
True
by
Tags:
Leave a Reply