UnboundLocalError: local variable part 2
Emile van Sebille
emile at fenx.com
Mon Jun 3 13:09:48 EDT 2002
Daniel
> That last example was a bit too contrived... instead of blah='abc',
> blah is actually a list and i'm appending and popping elements so
> func1 actually truly does affect the global blah. So a better example
> of the logic is:
There must be something else going on. I get exactly what you expected:
def func1():
blah.pop()
def func2():
print blah
blah.pop()
def main():
func1()
func2()
print blah
blah=[1,2,3]
main()
[1, 2]
[1]
--
Emile van Sebille
emile at fenx.com
---------
More information about the Python-list
mailing list