[Python-Dev] itertools.walk()

Raymond Hettinger python at rcn.com
Wed Mar 16 12:19:54 CET 2005


Some folks on comp.lang.python have been pushing for itertools to
include a flatten() operation.  Unless you guys have some thoughts on
the subject, I'm inclined to accept the request.

Rather than calling it flatten(), it would be called "walk" and provide
a generalized capability to descend through nested iterables (similar to
what os.walk does for directories).  The one wrinkle is having a
stoplist argument to specify types that should be considered atomic
eventhough they might be iterable (strings for example).


Raymond Hettinger


More information about the Python-Dev mailing list