why does this not work!!! AAARRRGH!!!!!!!!
Simon Brunning
SBrunning at trisystems.co.uk
Thu Sep 28 09:38:51 EDT 2000
More information about the Python-list mailing list
Thu Sep 28 09:38:51 EDT 2000
- Previous message (by thread): why does this not work!!! AAARRRGH!!!!!!!!
- Next message (by thread): why does this not work!!! AAARRRGH!!!!!!!!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> From: Matthew Banham [SMTP:matb at photond.com] > why does the following code (declared in a module) not work when I call > myfunc? > > global myglobalvar > myglobalvar = 101 > > def myfunc(): > myglobalvar = myglobalvar + 1 > > It gives an Unbound Local Error in the myglobalvar = myglobalvar + 1 line > Try: myglobalvar = 101 def myfunc(): global myglobalvar myglobalvar = myglobalvar + 1 Funnily enough, the effect of the global statement isn't global! > It's driving me madd > aaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrggggggggggggggghhhhhhhhhhh!!!!!!!!!!!!!!!! > Stiff upper-lip, man. Remember - you're British. Cheers, Simon Brunning TriSystems Ltd. sbrunning at trisystems.co.uk ----------------------------------------------------------------------- The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot accept liability for statements made which are clearly the senders own.
- Previous message (by thread): why does this not work!!! AAARRRGH!!!!!!!!
- Next message (by thread): why does this not work!!! AAARRRGH!!!!!!!!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list