Pablo Galindo Salgado <pablog...@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 don't think so, this is the same as if you do:

def f(exc):
   del exc
   return exc

>>> f(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lel.py", line 3, in f
    return exc
UnboundLocalError: local variable 'exc' referenced before assignment

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40728>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to