general class functions
Josiah Carlson
jcarlson at uci.edu
Fri Nov 26 02:26:55 EST 2004
"syd" <syd.diamond at gmail.com> wrote:
> I guess the lesson is that globals() in an imported class is not the
> same as globals() in the main file.
Right, globals() is really the module-local namespace dictionary. That
is, the dictionary that is the top-level scope for the current module.
While there technically isn't really a 'global scope among all modules',
it can be faked pretty well via __builtins__.__dict__ (though is not
suggested, and without doing ugly things to the 'globals()' and
__builtin__ namespaces, you don't get simple assignments to it).
- Josiah
More information about the Python-list
mailing list