Built-in functions in Python that work with inheritance: 1- isinstance() – this method checks the type of instance. eg. isinstance(myObj, int) – returns True only when myObj. class is int. 2-issubclass() – this method checks class inheritance eg. ***issubclass(bool, int) – returns True because bool is a subclass of int. ***issubclass(unicode, str) – returns False because unicode is not a subclass of str.
Built-in functions in Python that work with inheritance:
1- isinstance() – this method checks the type of instance.
eg. isinstance(myObj, int) – returns True only when myObj. class is int.
2-issubclass() – this method checks class inheritance
eg. ***issubclass(bool, int) – returns True because bool is a subclass of int.
***issubclass(unicode, str) – returns False because unicode is not a subclass of str.