why does this not work!!! AAARRRGH!!!!!!!!

Matthew Banham matb at photond.com
Thu Sep 28 09:22:07 EDT 2000


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

It's driving me madd
aaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrggggggggggggggghhhhhhhhhhh!!!!!!!!!!!!!!!!

Yours Sincerely,
Matthew Banham



----------------------------------------------------------------------------
----
Matthew Banham, MSci
Development Engineer & Technical Support Officer

Photon Design                Tel:  +44 1865 395480
68 Church Way                Fax: +44 1865 395481
Iffley, Oxford               Email: matb at photond.com
OX4 4EF                      Web: www.photond.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Matthew Banham.vcf
Type: text/x-vcard
Size: 515 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20000928/b99c0db4/attachment.vcf>


More information about the Python-list mailing list