News for hackers. Stuff that matters.
Re:Perl 11 by duckerude on Wednesday October 24, 2018 @11:25AM (#18293212)
It's not quite that bad. Within a function, Python resolves scope statically, and the "del" statement terminates binding, but not the scope.

If a variable is assigned to somewhere in the function, even later in the function, or in an unreachable branch, accessing it will use the function's scope. If the variable doesn't have a value you get an UnboundLocalError.

Even after you del a variable, accessing it will raise an UnboundLocalError rather than look in another scope.

There are no comments on this comment yet.