This is an old copy of the Python FAQ. The information here may be outdated.

Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?

In Python 2.2 and later, you can inherit from builtin classes such as int, list, dict, as well as C types you create yourself.

In earlier versions, C objects are created by factory functions, and cannot be directly inherited. You can get around by using a Python class as a facade, and delegate to an internal C object as necessary.

The Boost Python Library (BPL, provides a way of doing this from C++ (i.e. you can inherit from an extension class written in C++ using the BPL).

CATEGORY: extending


A Django site. rendered by a django application. hosted by webfaction.