[Python-ideas] os.listdir with current working directory as default
Antoine Pitrou
solipsis at pitrou.net
Sun May 24 23:40:31 CEST 2009
Tarek Ziadé <ziade.tarek at ...> writes:
>
> As soon as your program is working with the filesystem, and is
> navigating into it by calling APIs like os.chdir, os.getcwd, etc,
> you have good chances to end up calling os.listdir on the current
> directory, and specifying os.curdir becomes superfluous imho
> because you know you are in os.curdir.
You'd better be careful with it. The "current directory" is process-wide and so
modifying it in a thread will affect all other threads in your program. I'm not
saying all programs have this characteristic, but relying on the current
directory rather than explicit paths isn't always a good idea...
Regards
Antoine.
More information about the Python-ideas
mailing list