[Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

Glenn Linderman v+python at g.nevcal.com
Tue Nov 13 00:52:15 CET 2012


On 11/12/2012 7:30 AM, Jan Matějek wrote:
>
> I believe the "human problem" here is that the one tends to gloss over 
> "local variable VARNAME", because it describes VARNAME and you already 
> think you know what that is, so you don't stop to think about it.
>
> The following would be better in this regard, IMO:
>
> "Variable VARNAME is local in FUNCNAME, but doesn't have a value at 
> line 123" 

+1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20121112/d30fa5d7/attachment.html>


More information about the Python-Dev mailing list