What is the difference between old style and new style classes in Python? When should I use one or the other?
New-style classes inherit from object
and must be written as such in Python 2.2 onwards (i.e. class Classname(object):
instead of class Classname:
). The core change is to unify types and classes, and the nice side-effect of this is that it allows you to inherit from built-in types.
Read descrintro for more details.