2 ms·
Really? Python's handling of reaching into the outer scope of a function is just as confusing (although I hear it is fixed in 3000?) Do you mean: try:
by jrockway 14y ago
Really? Python's handling of reaching into the outer scope of a function is just as confusing (although I hear it is fixed in 3000?)
Do you mean:
try:
foo = '42'
except Whatever:
raise
print "foo is %s" % foo
If so, I really like that feature. It's much clearer to me than what I'd write in another language:
foo = None
try:
foo = 42
...
- ostso 14y agoPerhaps 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.