[C++-sig] Getting a Python type object for a c++ type in wrapper code...
Alex Mohr
amohr at cs.wisc.edu
Tue Oct 4 19:55:25 CEST 2005
Hi folks,
I'm a relative boost.python newbie but I've been doing a ton with it and
I'm having a blast. Thanks for such an awesome package.
Here's my first newbie question.
Suppose I have two C++ classes that I'm wrapping -- Foo and Bar. In the
wrapper for Bar, I want there to be an attribute which holds the type
Foo. That is, from python I wan to be able to say:
>>> Module.Bar.fooType == Module.Foo
True
Something like def_readonly("fooType", <var-which-holds-type-for-Foo>)
would be ideal. I'd also like to be able to do this for python types,
like python's float. Is there a simple way to do this in my
Boost.Python code?
Thanks,
Alex
More information about the Cplusplus-sig
mailing list