D
dag4004
Hello,
I have a strange behavior with global and module.
Here is the module named: foo.py
bar = "egg"
def f1():
global bar
print bar
bar = "bob"
print bar
When i use it :
'egg'
'bob' # It seems to work
'egg' # Damned ! The value is not changing
'bob' # All seems good, grrr !
'bob'
I do not understand.
Is bar a global name?
With which dico do i work?
Is there some thing special to know when we use from --- import *
Is there some one an explanation?
Thanks.
Good hack.
Damien GERANTON
I have a strange behavior with global and module.
Here is the module named: foo.py
bar = "egg"
def f1():
global bar
print bar
bar = "bob"
print bar
When i use it :
'egg'
'egg'
'bob' # It seems to work
'egg' # Damned ! The value is not changing
'bob' # All seems good, grrr !
'bob'
I do not understand.
Is bar a global name?
With which dico do i work?
Is there some thing special to know when we use from --- import *
Is there some one an explanation?
Thanks.
Good hack.
Damien GERANTON