When a class is inherited from nothing, I have an instance type object.
>>> class A(): pass; >>> a = A() >>> type(a) <type 'instance'> >>> type(a) is A False >>> type(A) <type 'classobj'>
However, when I have the same class inheriting from the object, the created object is of type A.
>>> class A(object): pass; >>> a = A() >>> type(a) <class '__main__.A'> >>> type(a) is A True >>> type(A) <type 'type'>
What is the logic behind this? Does this mean that every class should inherit an object ?
source share