Values and objects
Ethan Furman
ethan at stoneleaf.us
Sat May 10 15:28:20 EDT 2014
On 05/10/2014 12:22 PM, MRAB wrote:
>
> UnboundLocalError is like NameError, except that Python knows that the
> name is local because somewhere in the function you're binding to that
> name and you haven't said that it's global or nonlocal. Having a
> different exception for that case makes it clearer to the user what the
> problem is.
Absolutely. At one point NameError was raised in both cases, which could be very confusing to track down.
--
~Ethan~
More information about the Python-list
mailing list