Re: global variables in imported modules

2010-05-16 Thread vsoler
On 17 mayo, 00:52, Patrick Maupin wrote: > On May 16, 5:38 pm, James Mills wrote: > > > On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > > > However, can I be 100% sure that,no matter how I access variable > > > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > > > that eit

Re: global variables in imported modules

2010-05-16 Thread Patrick Maupin
On May 16, 5:38 pm, James Mills wrote: > On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > > However, can I be 100% sure that,no matter how I access variable > > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > > that either reference of 'x' points to the same id(memory posi

Re: global variables in imported modules

2010-05-16 Thread vsoler
On 17 mayo, 00:38, James Mills wrote: > On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > > However, can I be 100% sure that,no matter how I access variable > > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > > that either reference of 'x' points to the same id(memory posit

Re: global variables in imported modules

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > However, can I be 100% sure that,no matter how I access variable > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > that either reference of 'x' points to the same id(memory position)? Yes it does unless you re-assign it. --

Re: global variables in imported modules

2010-05-16 Thread vsoler
On 17 mayo, 00:05, Patrick Maupin wrote: > On May 16, 4:42 pm, vsoler wrote: > > > > > Taken fromwww.python.org, FAQ 2.3 How do I share global variables > > across modules? > > > config.py: > > > x = 0   # Default value of the 'x' configuration setting > > > mod.py: > > > import config > > config

Re: global variables in imported modules

2010-05-16 Thread Rhodri James
On Sun, 16 May 2010 22:42:40 +0100, vsoler wrote: Taken from www.python.org, FAQ 2.3 How do I share global variables across modules? config.py: x = 0 # Default value of the 'x' configuration setting mod.py: import config config.x = 1 main.py: import config # try removing it impo

Re: global variables in imported modules

2010-05-16 Thread Patrick Maupin
On May 16, 4:42 pm, vsoler wrote: > Taken fromwww.python.org, FAQ 2.3 How do I share global variables > across modules? > > config.py: > > x = 0   # Default value of the 'x' configuration setting > > mod.py: > > import config > config.x = 1 > > main.py: > > import config       # try removing it >

global variables in imported modules

2010-05-16 Thread vsoler
Taken from www.python.org, FAQ 2.3 How do I share global variables across modules? config.py: x = 0 # Default value of the 'x' configuration setting mod.py: import config config.x = 1 main.py: import config # try removing it import mod print config.x The example, such as shown in t