开发者

Python: base class for all other classes

开发者 https://www.devze.com 2023-03-28 05:49 出处:网络
In Python, what is the base class for all other classe开发者_JS百科s (real Base), that all other classes inherit from?All new style classes inherit from object.

In Python, what is the base class for all other classe开发者_JS百科s (real Base), that all other classes inherit from?


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


It is object. At least in 2.7 and 3.1.

>>> class A():
...     pass
... 
>>> isinstance(A, object)
True
0

精彩评论

暂无评论...
验证码 换一张
取 消