Re: Python Global State

2009-02-03 Thread Hendrik van Rooyen
er wrote: >Simple question, I think: Is there a way to make a >completely global variable across a slew of modules? >If not, what is the canonical way to keep a global state? >The purpose of this is to try to prevent circular module >imports, which just sort of seems nasty. Thank you! T

Re: Python Global State

2009-02-03 Thread Gabriel Genellina
En Tue, 03 Feb 2009 17:10:18 -0200, er escribió: It might be nice if Python could provide a global dictionary, perhaps _G{}, where you can throw things. This is actually the solution provided by the Lua scripting language. Thanks for the global_ module solution, I was just making sure t

Re: Python Global State

2009-02-03 Thread er
That was my hack for one other app, but I did it because I'd only been studying Python for a month or two. Glad to see others did it once as well, but that we all wised up. =P It might be nice if Python could provide a global dictionary, perhaps _G{}, where you can throw things. This is actuall

Re: Python Global State

2009-02-03 Thread rdmurray
Quoth MRAB : > er wrote: > > Simple question, I think: Is there a way to make a completely global > > variable across a slew of modules? If not, what is the canonical > > way to keep a global state? The purpose of this is to try to prevent > > circular module imports, which just sort of seems nas

Re: Python Global State

2009-02-03 Thread Scott David Daniels
Gary Herron wrote: er wrote: Simple question, I think: Is there a way to make a completely global variable across a slew of modules? ... Create a module called, perhaps, global.py which contains your variables. Bad choice of names (a reserved word). Use globals, or data or global_. Othe

Re: Python Global State

2009-02-03 Thread Gary Herron
er wrote: > Simple question, I think: Is there a way to make a completely global > variable across a slew of modules? No. > If not, what is the canonical way to keep a global state? But this might satisfy: Create a module called, perhaps, global.py which contains your variables. global.py

Re: Python Global State

2009-02-03 Thread MRAB
er wrote: Simple question, I think: Is there a way to make a completely global variable across a slew of modules? If not, what is the canonical way to keep a global state? The purpose of this is to try to prevent circular module imports, which just sort of seems nasty. Thank you! Simple answ

Python Global State

2009-02-03 Thread er
Simple question, I think: Is there a way to make a completely global variable across a slew of modules? If not, what is the canonical way to keep a global state? The purpose of this is to try to prevent circular module imports, which just sort of seems nasty. Thank you! -- http://mail.python.org