[Python-3000] Removal of os.path.walk
Giovanni Bajo
rasky at develer.com
Thu May 1 03:04:35 CEST 2008
On Wed, 30 Apr 2008 16:02:31 -0700, Guido van Rossum wrote:
> There is one use case I can see for an iterator-version of os.listdir()
> (to be named os.opendir()): when globbing a huge directory looking for a
> certain pattern. Using os.listdir() you end up needed enough memory to
> hold all of the names at once. Using os.opendir() you would need only
> enough memory to hold all of the names THAT MATCH.
Not only that, but you can also start processing files one by one without
having to wait for the whole list to be constructed (which might take
time over a network file system); in fact, the user might even want to
abort the operation after a few files were processed, in which case the
whole directory is not accessed.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
More information about the Python-3000
mailing list