Where is
This question already has an answer here:
In Python 3, if you create a class without adding a parent class it automatically inherits from object. You can't create old style classes anymore like Python 2.
Example:
class A: # gets defaulted to class A(object):
pass
All classes in Python3 are subclasses of object
as you can see from the mro:
>>> class A: pass
...
>>> A.__mro__
(<class '__main__.A'>, <class 'object'>)
class A(object)
is still done in some Python 3 code to maintain backward compatibility with Python 2.
上一篇: 类定义参数与普通类定义
下一篇: 哪里