Property descriptors are only supported for the new-style classes that were introduced in Python 2.1. Property descriptors should only be used in new-style classes.

If you want to define properties in a class, then ensure that the class is a new-style class. You can convert an old-style class to a new-style class by inheriting from object.

In the following example all the classes attempt to set a property for x. However, only the third and fourth classes are new-style classes. Consequently, the x property is only available for the NewStyle and InheritNewStyle classes.

If you define the OldStyle class as inheriting from a new-style class, then the x property would be available for both the OldStyle and InheritOldStyle classes.

  • Python Glossary: New-style class.
  • Python Language Reference: New-style and classic classes, Descriptors.
  • Python Standard Library: Property.
  • The History of Python: Inside story on new-style classes.