strange unbound local error?
- From: righes@xxxxxxxx
- Date: Sat, 29 Sep 2007 11:04:39 -0700
hi folks,
suppose this snipplet:
spam = 42
def eggs():
print spam
spam = spam + 1
if __name__=="__main__":
eggs()
This thows an UnboundLocalError at line 4 (print statement). But if I
comment out line 5 (variable assignment), no error occurs.
Can you explain me this, please?
Regards,
Enrico
.
- Follow-Ups:
- Re: strange unbound local error?
- From: thebjorn
- Re: strange unbound local error?
- From: Pablo Ziliani
- Re: strange unbound local error?
- Prev by Date: Re: sorteddict [was a PEP proposal, but isn't anymore!]
- Next by Date: Re: Program inefficiency?
- Previous by thread: xml modifications
- Next by thread: Re: strange unbound local error?
- Index(es):
Relevant Pages
|