D
dan miller (moderator, s.p.d)
trying to figure out scoping of 'globals' in modules. So I have test.py:
glob = 1
def setglob(v):
global glob
glob = v
def getglob():
return glob
and I do this:
2
Seems to me like the first time I invoke glob, it creates a new global
in my namespace, and initializes it to the value of the glob in test.py.
Seems counterintuitive!
glob = 1
def setglob(v):
global glob
glob = v
def getglob():
return glob
and I do this:
2
Seems to me like the first time I invoke glob, it creates a new global
in my namespace, and initializes it to the value of the glob in test.py.
Seems counterintuitive!