recursive function: use a global or pass a parameter?

Yawar Amin yawar.amin at gmail.com
Sat Jan 17 00:29:21 EST 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