in-module global variables
Matthew Banham
matb at photond.com
Thu Sep 28 06:12:17 EDT 2000
Dear python users,
When writing a python module, how do I correctly declare a global variable-
i.e. a variable that has scope throughout the whole of the module?
For example, if I have a module called mymod.py with the following in it:-
myglobalvar = 10
def myfunc(somparm):
#here there are some commands
print myglobalvar
when I call myfunc from within the module, myglobalvar is not recognised
giving the "Unbound Local Error"
Can anyone help?
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/633069b8/attachment.vcf>
More information about the Python-list
mailing list