Claud Bejan :
What is the base class in python or base Object? For example we have base exception for the exceptions, but do we have a base class for the classes or objects?
Adam.Er8 :
It's the object
class.
You can check this by using inspect.getmro
which returns the entire class hierarchy of a type.
example:
import inspect
class A: # inherits nothing
pass
class B(A): # inherits A
pass
print(inspect.getmro(B))
print(inspect.getmro(A))
Output:
(<class '__main__.B'>, <class '__main__.A'>, <class 'object'>)
(<class '__main__.A'>, <class 'object'>)
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=386537&siteId=1