Linear Time Tree Traversal Generator

Chris Angelico rosuav at gmail.com
Wed Sep 21 13:33:20 EDT 2016


On Thu, Sep 22, 2016 at 3:15 AM, Random832 <random832 at fastmail.com> wrote:
> Or you can give up on recursion. Recursive tree traversal is generally
> associated with passing in a callback in rather than implementing an
> iterable-like interface that can be used with a caller's for-loop
> anyway.
>

Maybe in languages that don't _have_ good generators, but in Python,
the obvious way to iterate over something is with an iterator, not a
callback.

ChrisA



More information about the Python-list mailing list