HOWTO: ...create shallow boost::python::object copies ?
Jan. 24, 2008
5:35 p.m.
I'm accessing python objects from within C++, using the convenient bpl::object, bpl::list, etc. types. However, I just now realize that their constructors all (?) create new Python objects. How can I prevent that ? Imagine this python code: d = o.__dict__ d['new_member'] = 42 print o.new_member which I would like to write in C++: bpl::dict d = o.attr("__dict__") d["new_member"] = 42 However, as 'd' is a copy of o's __dict__ attribute, the new_member never makes it into o. How can I do what I want ? (Yes, in this case I obviously wouldn't need the indirection over 'd'; this is just a minimal test case...) Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin...
6832
Age (days ago)
6832
Last active (days ago)
0 comments
1 participants
participants (1)
-
Stefan Seefeld