os.chdir() considered harmful

gangli at msn.com gangli at msn.com
Mon Sep 25 10:29:15 EDT 2000


For Windows, there is a fast way to walk though directory trees:
http://www.deja.com/getdoc.xp?AN=668876760.1

If we change os.listdir to return a list of useString kind of object
that can do, isdir, getmtime, we can replace os.path.walk and take NT
advantage to speed up whole process


In article <mailman.969829719.7595.python-list at python.org>,
  Guido van Rossum <guido at beopen.com> wrote:
> In a neat little piece of code posted by Tim, I found this gem:
>
> skip ….
> Note that every modern Unix uses an effective cache for pathname
> parsing, so the speed argument doesn't apply there.  I suspect that it
> does apply on Windows though.
>
> I recently heard of an environment where CGI scripts were executed in
> multiple threads of the server rather than as subprocesses.  This
> requires a relatively small bit of discipline on behalf of the CGI
> scripts.  However they were forced to remove os.chdir() because it is
> shared between threads...


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list