[C++-sig] create a python object from scratch in boost.python?
Gary Oberbrunner
garyo at genarts.com
Tue Jan 21 19:52:06 CET 2014
----- Original Message -----
> From: "Stefan Seefeld" <stefan at seefeld.name>
...
> It seems what you really want is a way for your C++ code to
> manipulate pure Python objects, without any automatic type conversion.
Yes!
> So the cleanest way to do that would be to use the above definition of
> the "Effect" class (in Python), import that into your C++ runtime
> (via bpl::import()), and then instantiate an "Effect" object with your
> pre-defined dict object.
I'm trying to do this in a boost python extension, so it has to be all in C++. If I have to wrap some python around it, it'll become a bit too heavyweight.
I'd love to do what you suggest above, if it can be done all in C++. I think all I need is a way to create, in C++, an empty Python class object with a __dict__. Then, as you say, I can add attributes to it (at least I think I should be able to - but I'm not sure how far the boost.python world goes).
--
Gary Oberbrunner
More information about the Cplusplus-sig
mailing list