Serhiy Storchaka added the comment:

Adding "or got deleted" makes the error message longer, and since "del" is 
rarely used for deleting local variables I afraid that it can add confusion in 
most cases.

The "del" statement is not the only way to unset the local variable.

>>> def foo():
...     e = None
...     try:
...         1/0
...     except Exception as e:
...         pass
...     print(e)
... 
>>> foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 7, in foo
UnboundLocalError: local variable 'e' referenced before assignment

----------

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

Reply via email to