Is there a way to define a true global across modules?

robert no-spam at no-spam-no-spam.invalid
Fri Nov 3 18:39:13 CET 2006


Fredrik Lundh wrote:
> Hendrik van Rooyen wrote:
> 
>> I am struggling with this - I want to define a "system-wide" flag for 
>> use as a
>> semaphore.
> 
> http://www.effbot.org/pyfaq/how-do-i-share-global-variables-across-modules.htm 
> 

Or worse style - if you are too lazy to create a extra global variables module (ab)use the __main__ module als "global":


import __main__

__main__.mysemphore += 1



-robert



More information about the Python-list mailing list