Although Jochenβs answer is very useful and correct, since you can get the class hierarchy using the .ectmro () method of the inspect module, itβs also important to emphasize that the Python inheritance hierarchy is as follows:
eg:
class MyClass(YourClass):
Next class
- Children class
- Derived class
- Subclass
eg:
class YourClass(Object):
Inherited class
- Parent class
- Base class
- Superclass
One class can be inherited from another - class attributes are inherited - in particular, its methods are inherited - this means that instances of the inheriting (child) class can access the attribute of the inherited (parent) class
instance -> class -> then inherited classes
via
import inspect inspect.getmro(MyClass)
will show you the hierarchy inside Python.
Carson Feb 02 '18 at 15:38 2018-02-02 15:38
source share