global variables and local functions.
imbosol at vt.edu
Thu Aug 29 05:49:07 CEST 2002
Micah Mayo wrote:
> UnboundLocalError: local variable 'mlistLen' referenced before assignment
You need to put the statement "global mlistLen" at the top of your
function. When a variable is assigned to inside a function, Python
assumes it is a local variable everywhere in that function, unless you
declare it global.
More information about the Python-list