[Python-ideas] os.listdir with current working directory as default
Tarek Ziadé
ziade.tarek at gmail.com
Sun May 24 02:08:44 CEST 2009
On Sat, May 23, 2009 at 6:54 PM, Georg Brandl <g.brandl at gmx.net> wrote:
>
> If a default value is there, it should be obvious. In this case, my feeling
> was that it wasn't, but thinking about it I don't really see another default,
> so +0.
Since the feedbacks are positive, I have created an issue, and I'll
work on a patch (#6095)
>
>> Agreed, nobody writes "dir ." or "ls .", the implicit argument is obvious.
>
> Well, the interactive shell shouldn't be considered a programming language,
> and even if you do, it's hardly Pythonic :)
I don't think it's a matter of being in the interactive shell or not.
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.
Tarek
More information about the Python-ideas
mailing list