global variables and local functions.

Carl Banks imbosol at vt.edu
Wed Aug 28 23:49:07 EDT 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.


-- 
CARL BANKS
http://www.aerojockey.com



More information about the Python-list mailing list