Python: How to make a cross-module variable?
Posted
by Dan Homerick
on Stack Overflow
See other posts from Stack Overflow
or by Dan Homerick
Published on 2008-09-26T23:59:47Z
Indexed on
2010/05/29
3:12 UTC
Read the original article
Hit count: 298
The __debug__
variable is handy in part because it affects every module. If I want to create another variable that works the same way, how would I do it?
The variable (let's be original and call it 'foo') doesn't have to be truly global, in the sense that if I change foo in one module, it is updated in others. I'd be fine if I could set foo before importing other modules and then they would see the same value for it.
© Stack Overflow or respective owner