[Python-ideas] os.listdir default to '.'

Guido van Rossum guido at python.org
Fri Jan 13 00:11:24 CET 2012


On Thu, Jan 12, 2012 at 2:11 PM, Sven Marnach <sven at marnach.net> wrote:

> Cameron Simpson schrieb am Fr, 13. Jan 2012, um 08:32:23 +1100:
> > On 12Jan2012 15:14, Rob Cliffe <rob.cliffe at btinternet.com> wrote:
> > | Strictly speaking I think the default value should be
> > | os.path.curdir, not specifically '.'
> [...]
> >   -1 for os.curdir() being opendir's default.
>
> There's a misunderstanding here.  You are confusing 'os.getcwd()' and
> 'os.curdir'.
>
> The default value for the parameter of 'os.listdir()' should probably
> be 'os.curdir', but since it is defined in the different
> platform-specific OS modules like posixmodule.c, it probably is
> 'os.curdir'.  Moreover, I'm not aware of a platform where
> os.curdir != '.'
>

The default for os.listdir() should be the current directory by whatever
name it is known. os.curdir is ':' in macpath.py (which applies to MacOS
1-9, not OS X).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120112/a35ffdfc/attachment.html>


More information about the Python-ideas mailing list