> MY_GLOBAL, by virtue of being assigned to later in the function, and the
> absence of a global statement, is identified as a local variable.
> When a function contains a
> single assignment (or augmented assignment) to a name, the compiler
> generates bytecode such that all references to that na
On Jul 15, 2009, at 1:55 PM, Rodrigue wrote:
Basically, I was very surprised to discover that e() raises an
exception, but even more that e_raise() points to
if not MY_GLOBAL Is the problem not really when I assign?
My assumption is that some reordering is happening behind the scenes
that creat
On 7/15/2009 10:55 AM Rodrigue said...
I came accross a strange behaviour in python today. Here is a simple
example to describe my situation:
MY_GLOBAL = ''
def e_raise():
if not MY_GLOBAL:
MY_GLOBAL = 'bla'
Traceback (most recent call last):
File "glo.py", line 49, in
Hi all,
I came accross a strange behaviour in python today. Here is a simple
example to describe my situation:
MY_GLOBAL = ''
def a():
print 'global is: ', MY_GLOBAL
def b():
try:
MY_GLOBAL += 'bla'
except Exception, e:
print 'b: ', e
def c():
try:
globa