Puzzling: local variable in recursive function made global?
andrew at acooke.org
Thu Mar 26 18:09:23 CET 2009
Diez B. Roggisch wrote:
> That's not a local variable, that is a default argument. Which is in
> fact only created once for each function, yes.
a nice way of handling this was posted here just yesterday, which isn't in
the ffbot page (afaik):
# None will force use of empty list here:
for x in listvar or :
# Do soemthing with contents here
listvar = listvar or 
although the "if arg is None..." is pretty standard python that makes it
clear exactly what you are doing.
More information about the Python-list