Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: base class for all other classes

Tags:

python

In Python, what is the base class for all other classes (real Base), that all other classes inherit from?

like image 469
Jakub M. Avatar asked Dec 31 '25 18:12

Jakub M.


2 Answers

All new style classes inherit from object.

New-style classes were introduced in Python 2.2 to unify classes and types. Here there is a nice description of what a new style class is. – Paolo Moretti

like image 143
Jakob Bowyer Avatar answered Jan 02 '26 06:01

Jakob Bowyer


It is object. At least in 2.7 and 3.1.

>>> class A():
...     pass
... 
>>> isinstance(A, object)
True
like image 45
utdemir Avatar answered Jan 02 '26 07:01

utdemir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!