[Tutor] Newbie: "Global" vars across modules

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Dec 3 19:39:29 EST 2003


> Here's my problem:  I want to create a global variable that
EVERY module
> can see.  Why?  Because I like to define a "debug_level"
variable to print
> out debugging information.

I usually recommend setting an environment variable at the
operating system for this. That way each module can read
the environment variable (using os.getenv) at runtime and
you can change it without modifying the code.

Alan g.




More information about the Tutor mailing list