if not global -- then what?
MRAB
python at mrabarnett.plus.com
Sat Feb 20 15:00:23 EST 2010
egasimus wrote:
> Hi, newbie here. I've read on using the 'global' keyword being
> discouraged; then what is the preferred way to have something, for
> example a class containing program settings, accessible from
> everywhere, in a program spanning multiple files?
Python's 'global' keyword is global in a file (module), not global
across multiple files, so it would have helped you anyway.
If you want program settings accessible across multiple modules then put
the settings in a module and import that module in any other module that
needs to access them.
More information about the Python-list
mailing list