[issue16703] except statement turns defined variable into undefined

2012-12-18 Thread Brett Cannon
Brett Cannon added the comment: As Mark pointed out, this is on purpose and is not going to change since Python lacks block-level scoping of variables and thus causes the last case related to the variable to take precedence. It might be a little unexpected, but it's not that unreasonable when

[issue16703] except statement turns defined variable into undefined

2012-12-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I understand that such behavior change needed was a good reason. But the current behavior is quite confusing. -- ___ Python tracker ___ _

[issue16703] except statement turns defined variable into undefined

2012-12-17 Thread Mark Dickinson
Mark Dickinson added the comment: This is a deliberate feature of Python 3. See PEP 3110. -- nosy: +mark.dickinson ___ Python tracker ___ ___

[issue16703] except statement turns defined variable into undefined

2012-12-17 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Example: >>> err = None >>> try: raise ValueError ... except ValueError as err: pass ... >>> err Traceback (most recent call last): File "", line 1, in NameError: name 'err' is not defined It is expected that either the variable will have the catched va