os.path.walk (was: Re: Optimizing code)
François Pinard
pinard at iro.umontreal.ca
Fri Feb 25 10:50:07 EST 2000
"Gordon McMillan" <gmcm at hypernet.com> écrit:
> There's also a dircache module, which caches os.listdir output, and
> stats the directory to see if the cache is still valid. These tricks get
> wildly platform specific though. In my experience on Windows [...] if
> the cache is less than 2 seconds old, you can't assume it is valid.
I do not think my suggestion would be worth on anything but Unix, and I
was not suggesting it for other systems. It is just sad to see that Python
`os.path.walk' is implemented slow on Unix, because of how Windows works.
I quite understand Guido's concern for maintainability and portability,
yet the speed loss, here, is significant enough to warrant a second thought.
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list