Possible Duplicate:
Old style and new style classes in Python
python class inherits object
What's the difference between
class foo:
and
class foo(object):
Can anyone explain why we are using object in class definition?
Possible Duplicate:
Old style and new style classes in Python
python class inherits object
What's the difference between
class foo:
and
class foo(object):
Can anyone explain why we are using object in class definition?
In Python 2.x the first declaration is an old-style class and the second version is a new-style class. You should always use new-style classes for new code.
In Python 3 all classes are new-style so there is no difference.