global variables

Steve Holden steve at holdenweb.com
Wed Feb 2 18:26:16 EST 2005


alex wrote:

> Hi,
> 
> is it possible to create 'global' variables that can be seen in all
> other classes?
> 
> Alex
> 
Not sensibly, though you can mess around with the __builtin__ namespace 
to make values accessible without qualification.

The usual solution is to maintain a config module that establishes 
default settings for configuration variables. Other modules that import 
config can access (and change) those values using

   config.name = value

and so on. Hope this help.

regards
  Steve
-- 
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005                      http://www.pycon.org/
Steve Holden                           http://www.holdenweb.com/



More information about the Python-list mailing list