Puzzling: local variable in recursive function made global?

Diez B. Roggisch deets at nospam.web.de
Thu Mar 26 17:50:20 CET 2009

Daniel Oberski schrieb:
> Hello all,
> I wrote this function to recurse through a tree structure of Nodes 
> connected by Branches. 
> I use a local variable seen_nodes to mark off Nodes already seen by the 
> function (i.e. add them to a list).

That's not a local variable, that is a default argument. Which is in 
fact only created once for each function, yes.



More information about the Python-list mailing list