[C++-sig] Supplying a Python base class when wrapping a C++ class...

David Abrahams dave at boost-consulting.com
Fri Nov 3 15:31:51 CET 2006


Alex Mohr <amohr at pixar.com> writes:

> I'd like to wrap a C++ class and have the generated python wrapper class 
> derive from a Python class.
>
> I know I can use bases<> to have my wrapped class derive from the class 
> objects associated with the C++ types I specify in bases<>, but in this 
> instance, I want to derive my wrapper class from a Python class that was 
> not generated by boost.python.
>
>  From looking at the code, it seems like it would be some work to add 
> this capability.  (Is anyone working on something like this?)

That feature has been on my mental TODO list for a long time.  Last
time I looked, it was implementable.

> As a workaround, does anyone know a way that I could perhaps hack this 
> in after the Python class is created?  That is, can I change the Python 
> base classes of a Python class at runtime?

I'm not sure about that.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list