dynamic casting in python

Christian Reyes christian at rocketnetwork.com
Fri Apr 20 15:19:02 EDT 2001


well, I have used Phil Thompson's SIP wrapper generator to wrap a C++ API.
My problem is that i have two classes , say MyClass and MyClass2 two.
MyClass2 us a virtual interface class that derives from nothing.

In C++ if i want to use the MyClass2 methods on a MyClass object, I simply
do a dynamic cast from the MyClass instance to a MyClass2 object.

I have wrapped both MyClass and MyClass2 into a python module but I need to
figure out how to call the MyClass2 methods on a MyClass instance.

make sense?

Of course, I could tweak the SIP generator to do a dynamic cast in C++
before assigning instance to a pythonobject, but I'm trying to avoid that.
If any of you have seen the SIP package... it's kinda hairy to say the
least.

My other alternative is to get my dev team to add a call to my C++ api that
does the casting for me and then wrap that into python...

:)c
Of course, I could always
"Courageous" <jkraska1 at san.rr.com> wrote in message
news:bo8vdtc2lg7non6oegcdalkpbl36ofoo2j at 4ax.com...
>
> >How do I do it?
> >Is it possible?
>
> Eh? What do you want to accomplish?
>
> C//
>





More information about the Python-list mailing list