[issue40728] UnboundLocalError as a result of except statement variable re-assignment

Oleksandr Suvorov report at bugs.python.org
Fri May 22 07:10:40 EDT 2020


Oleksandr Suvorov <susliko at gmail.com> added the comment:

But then why I still can access this variable? Shouldn't it then be
resulting in NameError as it's undefined variable at this point of time?
I think UnboundError creates more confusing here, as it's either the
variable should exist and have a value or it should be unknown and result
in NameError at this point.

On Fri, May 22, 2020 at 1:08 PM Pablo Galindo Salgado <
report at bugs.python.org> wrote:

>
> Change by Pablo Galindo Salgado <pablogsal at gmail.com>:
>
>
> ----------
> nosy: +Mark.Shannon
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <https://bugs.python.org/issue40728>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40728>
_______________________________________


More information about the Python-bugs-list mailing list