Manual
Return a new featureless object. object is a base for all classes. It has the methods that are common to all instances of Python classes. This function does not accept any arguments.
Note object does not have a __dict__, so you can’t assign arbitrary attributes to an instance of the object class.
直译
返回一个新的无特征对象,object是所有类的基类,他有所有Python类实例的通用方法,该函数不接受任何参数。
注意:object没有__dict__方法,所以你不能给某个object类的实例分配任意属性。
实例
# 赋值声明
>>> a = object()
>>> type(a)
<class 'object'>
>>> isinstance(a, object)
True
# 类声明
# 不注明继承时,也可默认继承自object
>>> class CSDN(object):
def __init__(self):
print('Hello world!')
>>> type(CSDN)
<class 'type'>
>>> isinstance(CSDN, object)
True
>>> isinstance(CSDN, type)
True
>>> isinstance(object, type)
True
Note
注意实例中两种声明的差别