setting variables in outer functions
hniksic at xemacs.org
Mon Oct 29 22:08:45 CET 2007
Tommy Nordgren <tommy.nordgren at comhem.se> writes:
> Given the following:
> def outer(arg)
> avar = ''
> def inner1(arg2)
> # How can I set 'avar' here ?
I don't think you can, until Python 3:
Currently the (ugly) solution is to change variable assignment to
avar = ['']
# use avar where you'd normally use avar
# modify the value of avar by setting avar
More information about the Python-list