A number of tools are available to simplify the construction of Python extensions
Extension classes, written by Jim Fulton and available at http://www.digicool.com/releases/ExtensionClass/, provide a mechanism for defining extension types that are more class-like. In particular, they can be sunclassed in C or Python, and provide better interaction with documentation strings and other aspects of the interpreter.
ExtensionClass(github), a meta-class implementation for Python before Python had user-customizable meta classes.
From github, ExtensionClass as a package provides a metaclass that allows classes implemented in extension modules to be subclassed in Python. Unless you need ExtensonClasses for legacy applications, you probably want to use Python’s new-style classes (available since 2.2).
This package provides a way to attach attributes to an ExtensionClass or instance that are computed by calling a callable. This works very much like property known for new-style classes, except that a ComputedAttribute can also be attaced to an instance and that it honours ExtensionClass semantics.