[Tutor] Accessing local variables from nested functions.
krzys_kyku at tlen.pl
Sun Feb 13 11:41:27 CET 2005
what's the Python way of accessing local variables in nesting functions? For
example if I have:
var1 = 3
print 'var1 in p is', var1
then there's no problem in running such function, but what if I'd like to
modify var1 so that the change were vissible in p()?
I can't label var1 as global in q, because it then creates a new var1 in the
module scope, leaving the nested one untouched.
Thanks in advance
More information about the Tutor