[Python-Dev] Re: os.path.walk() lacks 'depth first' option
Guido van Rossum
guido@python.org
Thu, 24 Apr 2003 12:50:25 -0400
> From: Michael Chermside <mcherm@mcherm.com>
> Tim:
>
> Don't get a swelled head or anything ;-), but your generator-based
> version of walk() is beautiful piece of work. I don't mean the code
> (although that's clean and readable), but the design. Using a
> generator is clearly good, having it return (path,names) tuples is a
> nice way to work, and having it return (path,dirnames,filenames)
> tuples is inspired. (If you want them lumped together, just add the
> lists!) Allowing the consumer to modify control the flow by
> modifying dirnames is very nice. And the fact that it's so simple to
> code (22 short lines) is a testament to the power of generators.
>
> I'm +2 on putting this in immediately and deprecating os.path.walk().
Agreed. How about naming it os.walk()? I think it's not OS specific
-- all the OS specific stuff is part of os.path. So we only need one
implementation.
--Guido van Rossum (home page: http://www.python.org/~guido/)