F
francisl
I have a problem when I declare global variable.
If it is string, dict, array or tuple, everything goes fine, but with int, I get an "used before declaration" error.
here a sample :
vardict = {'un':1, 'deux':2}
def print_value():
print vardict['un']
######### ok, that works
--------------------
#!/bin/python
varint = 1
def print_value():
print varint
######### ok, that failed
python 2.3.4 - windows2000
(it works in linux!)
If it is string, dict, array or tuple, everything goes fine, but with int, I get an "used before declaration" error.
here a sample :
vardict = {'un':1, 'deux':2}
def print_value():
print vardict['un']
######### ok, that works
--------------------
#!/bin/python
varint = 1
def print_value():
print varint
######### ok, that failed
python 2.3.4 - windows2000
(it works in linux!)