Revision 1 as of 2006-02-17 15:35:37

Clear message

Python is a mature language, but it hasn't stopped evolving, and there are some issues to consider when coding Python, if you want your code to work with the latest version of Python in five five years from now...

New style classes

Currently, there are two kinds of classes in Python. The 'classic' or old style classes, and the new style classes. Old style classes will go away in some future version, and while most code will still work when the default swaps from old style to new style, there are some differences in semantics, and the new style classes have some extra features. See http://www.python.org/doc/newstyle.html

Use new style classes in new code

Don't write

class X:
    pass

Write

class X(object):
    pass

Unable to edit the page? See the FrontPage for instructions.