globals accros modules

alf ask at me
Thu Jan 11 08:52:42 EST 2007


Gabriel Genellina wrote:
> Change a=1 to amodule.a=1

I have multiple command line programs creating 'a' and amodule using it. 
   Plus some import sequence dependency. So it would not work. Currently 
the solution in amodule is:
import __main__
print __main__.a

> If you find yourself doing tricks with the module globals, think about 
> redesigning your application.

For what I do it is good enough. If I hit the same problem, will 
refactor it.

A.



More information about the Python-list mailing list