[C++-sig] Abstract class instances to-python conversion

Jim Bosch talljimbo at gmail.com
Sun Jul 31 07:38:50 CEST 2011


On 07/30/2011 03:18 PM, Valentin Perrelle wrote:
> Thanks to you, I know understand some points i couldn't catch reading
> the manual 3-4 times. I'm now able to fix the current problem by
> importing my module before assigning the variable 'keyboard'. Which
> leads me to another question : is there a way to register converters
> without importing the module ?
>

Hmm.  That's a little tricky.  You can of course put your "class_" 
definitions in an arbitrary C++ function, and call that somehow before 
importing the module, but then you really shouldn't call that function 
again when importing because that would register some bits of the class 
twice.

I guess I don't really understand how your program flow is supposed to 
work - how did you plan to invoke C++ code from Python before importing 
your Boost.Python module?  Usually the natural place to register 
converters is during module import after you've registered the classes.

Jim


More information about the Cplusplus-sig mailing list