首先说明python3中无论写不写(object),默认的会自动带上,所以在python3中写不写都一样
class Student1:
pass
class Student2(object)...:
pass
print(dir(Student1()))
print(dir(Student2()))
['__class__', '__delattr__', '__dict__', '__...reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
['__class...reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
可以看出两个的所具有相同的属性...,因为继承了object
若不继承则只有__doc__ , __module__ 这两个属性,因为上边的属性,我们都要使用,所以一般是继承的。