>>> 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?
object) and "old" style classes (which doesn't inherit fromobject): "A "New Class" is the recommended way to create a class in modern Python." The word "modern" is meaning Python version 2.2 and up to 2.7, in Python 3 all classes are new-style classes.