2 May
2016
2 May
'16
11:21 a.m.
On Mon, May 2, 2016, at 10:35, Bruce Leban wrote:
Using a single letter (or short) variable name works well most of the time but has one problem: the variable can leak. It's easy to forget to write the del statement. Imagine a block statement that had the effect of deleting any variables initialized in the block.
Should it delete the variables, or should it be a new scope? They're subtly different. If the former, how do you differentiate a variable initialized in the block from a variable assigned in the block? What if you really *do* want to keep one of them? (The answer in both cases if it's a new scope would be to use "nonlocal")