What is UnboundLocalError for?

Paul Prescod paul at prescod.net
Thu Jul 13 00:20:00 EDT 2000


lex wrote:
> 
> Tee hee.  I'll get control over that pesky mouse one of these days.
> 
> This is what I meant to paste in:
> 
> >>> def f(): l = l + 1
> ...
> >>> f()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "<stdin>", line 1, in f
> UnboundLocalError: l
> >>>

Would this have helped:

UnboundLocalError: Local variable l referenced before assignment

http://sourceforge.net/patch/download.php?id=100874
http://sourceforge.net/patch/?func=detailpatch&patch_id=100874&group_id=5470



-- 
 Paul Prescod - Not encumbered by corporate consensus
Simplicity does not precede complexity, but follows it. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html




More information about the Python-list mailing list