[Python-Dev] os.path.walk() lacks 'depth first' option

David Ascher DavidA@ActiveState.com
Sun, 20 Apr 2003 17:49:56 -0700

Guido van Rossum wrote:
>>Recently I realized that there is no easy way to
>>walk a directory tree and rename each directory and file.
>>The standard os.path.walk() function does a breadth first walk.
> This idea has merit, although I'm not sure I'd call this depth first;
> it's more a matter of pre-order vs. post-order, isn't it?
> But I ask two questions:
> - How often does one need this?
> - When needed, how hard is it to hand-code a directory walk?  It's not
>   like the body of the walk() function is rocket science.

That's hardly the point of improving the standard library, though, is 
it?  I'm all for putting the kitchen sink in there, especially if it 
originates with a use case ("I had some dishes to wash..." ;-)