Global utility module/package

Scott David Daniels scott.daniels at acm.org
Mon May 8 18:29:48 EDT 2006


Christoph Haas wrote:
> As I know that importing packages from multiple modules always keeps it a
> singleton I thought of something like this:
> 
> Util.py:
> ~~~~~~~~
> debugFlag = False
> vibranceLevel = 'good'
> 
> def function1():
>    global debugFlag
>    print debugFlag

The global line is not needed: global declarations are only required
if you need to _write_ on globals w/in the function.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list