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
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
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
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.
--
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
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
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
>
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