Inheritance in extension types

Boudewijn Rempt boud at
Tue Sep 11 12:10:01 CEST 2001

Adrien Hernot <amh at> wrote:

> Hi!
>   I am stuck in a problem concerning python extensions. I am quite new to
> python and will try to describe my problem as precisely as possible.
> I want to export several C++ classes to python. I succeded for most of the
> functionalities I want, but for one: inheritance. That is, I would like the wrapper to class A
> to be able to access function in class B if B is a base of A. Also, I would like
> a function accepting B as argument to be able to accept A. For that I need inheritance
> information for my wrappers to use.

That is more or less what Phil has done with Qt - if C++ class B
inherits C++ class A, you can create an instance of class B from Python
and access the methods of A (if they have not been redefined in B).
Take a look at sip to see how it's done:


Boudewijn Rempt  | 

More information about the Python-list mailing list