Re:Actually, you don't understand lexical scope
by ostso on Monday September 17, 2012 @10:11PM
(#4535931)
Perhaps mistercow means things like
def foo():
x = 5
def bar():
print x
def baz():
x = 6
print x
bar()
baz()
print x
Which prints 5, 6, 5. If baz tried to print x before assigning, it would be an UnboundLocalError.
Do you mean:
If so, I really like that feature. It's much clearer to me than what I'd write in another language: