New-style classes has been integrated into Python 2.7 and old-style classes has been removed in Python 3. Please refer to the Python tutorial and the Descriptor HowTo Guide for more up-to-date documentation about classes and descriptors respectively.
Unfortunately, new-style classes have not yet been integrated into Python's standard documentation. Fear not, however; many people have worked to provide useful information on creating and using new-style classes:
- Unifying types and classes (aka descrintro) is Guido's essay on new-style classes and should be your starting point.
- Raymond Hettinger's How-To Guide for Descriptors focuses on the single most useful aspect of new-style classes (which includes properties).
- Python 2.3 Method Resolution Order (MRO) covers multiple inheritance.
- Metaclasses will make your head explode. Here are several approaches to discussing them:
- Types and Objects is the start of a new-style class tutorial with lots of figures and examples, but it's rough and not complete.
|||The original article cannot be found on DeveloperWorks anymore. We've replaced it with a mirror.|