[Python-ideas] os.listdir default to '.' (original) (raw)

Sven Marnach sven at marnach.net
Thu Jan 12 23:11:36 CET 2012


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 != '.'

-- Sven



More information about the Python-ideas mailing list