syntax glitch with +=

David Eppstein eppstein at ics.uci.edu
Thu Feb 20 18:42:58 EST 2003


In article <3e555d68$0$49099$e4fe514c at news.xs4all.nl>,
 Irmen de Jong <irmen at -NOSPAM-REMOVE-THIS-xs4all.nl> wrote:

> You're getting
> UnboundLocalError: local variable 'l' referenced before assignment
> right? This error has nothing to do with a presumed difference
> between extend and +=, in this case.

The existence of the error is what I was referring to, yes.
Once you add the global statement, of course it works, but the context 
in which I ran across this, the variable was in a nested non-global 
scope.

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/




More information about the Python-list mailing list