which methods of Python are used to determine the type of instance and inheritance? Prakash nidhi Verma 155620-Jul-2018pythonvariable python Updated on 19-Sep-2020
Prakash nidhi Verma
20-Jul-2018Built-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.