recursive function: use a global or pass a parameter?

Yawar Amin yawar.amin at gmail.com
Sat Jan 17 06:29:21 CET 2015


On Friday, January 16, 2015 at 9:24:15 PM UTC-5, Yawar Amin wrote:
> [...]
>         vals.extend(curr_obj.values())

Ah, I should mention that the above will do a breadth-first search. If
we want to do a depth-first search we simply replace the above line
with:

    vals.extendleft(curr_obj.values())

Regards,

Yawar



More information about the Python-list mailing list