[Python-3000] Removal of os.path.walk

"Martin v. Löwis" martin at v.loewis.de
Wed Apr 30 09:58:08 CEST 2008


> I don't know how compelling it is, but the dirread Plan 9 call to get
> a directory listing
> (http://plan9.bell-labs.com/magic/man2html/2/dirread) returns only a
> subset of the entries in the directory so it effectively acts as an
> iterator.

All operating system APIs to read directories work in this way;
Plan 9 is not unique (here).

> If it's listing a network shared file system an iterator
> version of listdir could result in less network traffic depending on
> what entry you were looking for.  I don't know if NFS is the same but
> I think in general it would be a win for network file systems in terms
> of efficiency.

Still, Guido's question stands: do you have an actual use case where
you would want to stop earlier? Even if you glob, you still need to
read to the end of the directory.

Regards,
Martin


More information about the Python-3000 mailing list