What is UnboundLocalError for?

Alex cut_me_out at hotmail.com
Wed Jul 12 18:32:28 EDT 2000


(Python 2.0 question.)

I was wondering what situations the UnboundLocalError exception is
intended to be thrown in.  I encountered it when I made a mistake like
this:

>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 1, in f
UnboundLocalError: l
>>> 

This was much more confusing to me than a simple NameError, which is
what python 1.5 throws for the same mistake.  Perhaps I'm biased,
though.

Alex.


    



More information about the Python-list mailing list