[C++-sig] Python scopes in C++
Marc Lazareff
Marc.Lazareff at onera.fr
Tue Feb 15 19:30:59 CET 2005
Hello,
Our software uses Python bindings (through SWIG) for C++ "description"
classes, implementing a data-oriented user interaction model.
These classes are data containers, managing attribute/value pairs
through C++ maps, images of the corresponding Python dictionaries for
Python "description" objects. C++ description objects themselves are
"registered" with a global manager.
All goes well as long as we treat all entities in a unique, global,
scope. But this mechanism does not respect Python scopes, because all
objects are registered on the same level, so that :
import spam
and :
from spam import *
have equivalent results for the C++ data structure, which does not
respect the Python scoping logic.
Thus we need to replicate in our C++ code the Python scopes mechanism.
I wondered if any of you had experience with a solution for this
problem, maybe re-using the Python C code.
Thank you for any advice,
Marc Lazareff
More information about the Cplusplus-sig
mailing list