Defining inheritance in C extensions

Martin von Loewis loewis at
Fri Nov 9 14:08:48 CET 2001

Timo Savola <timo.savola at> writes:

> Now I'm doing an extension module, or rather a system that I want to
> control via Python. I have a C++ class hierarchy that I want to be
> accessible from Python. I can't figure out how to make a type object a
> subclass of another type object, so that I can do type checking in the
> Python wrappers of my methods.

In Python 2.1 and earlier, type objects don't inherit from each other,
unless you use the ExtensionClasses package.

However, I'd argue that you don't need to reflect the C++ hierarchy in
the Python types at all: just make the Python types completely
unrelated to each other.


More information about the Python-list mailing list