>>> class MyKlass:
... pass
...
>>>
>>>
>>> a = MyKlass()
>>>
>>> type(a)
<type 'instance'>
>>> type(MyKlass)
<type 'classobj'>
>>>
>>>
>>> class MyKlass(object):
... pass
...
>>>
>>> a = MyKlass()
>>>
>>> type(a)
<class '__main__.MyKlass'>
>>> type(MyKlass)
<type 'type'>
>>>
In my above code, one class is not inherited from any base class and the other is inherited from object
base class.
I have read somewhere if you do not inherit explicitly, the default parent class is object
, am I right?
But if default is object
, why type to both class is different? When and how these above different behaviour is useful?