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

Walter Dörwald walter@livinglogic.de
Tue, 22 Apr 2003 17:57:12 +0200


Guido van Rossum wrote:

>>Guido van Rossum wrote:
>>
>>>But if I had to do it over again, I wouldn't have added walk() in the
>>>current form.
>>
>>I think it's the perfect place for a generator.

Has anybody considered Jason Orendorff's path module
(http://www.jorendorff.com/articles/python/path/)
for inclusion in the standard library? It has a path walking
generator and much, much more.

> Absolutely!  So let's try to write something new based on generators,
> make it flexible enough so that it can handle pre-order or post-order
> visits, and then phase out os.walk().

This new generator should probably support callbacks that determine
whether directories should be entered or not.

Bye,
    Walter Dörwald