[Python-Dev] Re: os.path.walk() lacks 'depth first' option
20 Apr 2003 22:14:02 -0400
[Guido van Rossum]
> But if I had to do it over again, I wouldn't have added walk() in the
> current form. I often find it harder to fit a particular program's
> needs in the API offered by walk() than it is to reimplement the walk
I do not much use `os.path.walk' myself. It is so simple to write a small
walking loop with a stack of unseen directories, and in practice, there is
a wide range of ways and reasons to walk a directory hierarchy, some of
which do not fit nicely in the current `os.path.walk' specifications.
> That's why I'm concerned about adding to it.
The addition of generators to Python also changed the picture somewhat, in
this area. It is often convenient to use a generator for a particular walk.
François Pinard http://www.iro.umontreal.ca/~pinard