variable scope in try ... EXCEPT block.
Chris Angelico
rosuav at gmail.com
Fri Jul 13 09:58:40 EDT 2018
On Fri, Jul 13, 2018 at 10:43 PM, Ed Kellett <e+python-list at kellett.im> wrote:
> On 2018-07-12 18:00, Chris Angelico wrote:
>> What do you mean by "fix"? Make the 'x' bind eagerly? That would break
>> basically every other use of closures.
>
> No. I mean make each x a new variable--closures would work as before,
> for-loops would change. If we have subscopes, it seems natural that
> entering a subscope multiple times creates a new instance of that
> subscope's namespace.
Wait, "if we have subscopes"? Nobody's suggesting that a for loop
would introduce a subscope. That would completely and utterly destroy
any code that uses the iteration variable post-loop.
ChrisA
More information about the Python-list
mailing list