On 24/03/2018 16:02, Steven D'Aprano wrote:
Yes, I get functions, and I think function-scope is a sweet spot between too few scopes and too many. Remember the bad old days of BASIC when all variables were application-global? Even if you used GOSUB as a second-rate kind of function, all the variables were still global.
On the other hand, introducing sub-function scopes is, I strongly believe, too many.
We are all entitled to our beliefs. But the decision was made to stop a for-variable from leaking from a list comprehension - you may not agree with that decision, but it was presumably a reasonable one. Using SLNBs that don't leak into the surrounding local scope is ISTM a similar decision, and one that, if made, would be made for similar reasons. Rob Cliffe