accessing module global vars by name
Peter Hansen
peter at engcorp.com
Mon Dec 20 05:02:24 EST 2004
Martin Drautzburg wrote:
> Withing a module I can assign a value to a global var by assigning to
> it in the outermost scope. Fine.
>
> But how can I do this if the attribute name itself is kept in a
> variable. Once the module is loaded I can access the module's
> namespace no problem, but inside the module the dictionary is not yet
> present right ?
Look into the builtin function globals()...
-Peter
More information about the Python-list
mailing list