New submission from Matthias Bussonnier:

Raymond Hettinger reported during PyCon Canada 2016 Keynote (~20m30 sec)
that unbound local error message was inaccurate, it state that :

> local variable 'xxx' referenced before assignment

Though it can be assigned and deleted.

    for a toy example:

       def foo():
          x = 1
          del x
          print(x)

       foo()

Do the same for free variable.

    def multiplier(n):
        def multiply(x):
            return x * n
        del n
        return multiply

The error message can be improved by adding "or got deleted".

----------
messages: 288023
nosy: mbussonn
priority: normal
pull_requests: 102
severity: normal
status: open
title: Improve UnboundLocalError message for deleted names
type: enhancement
versions: Python 3.7

_______________________________________
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