[Python-ideas] os.listdir with current working directory as default

Georg Brandl g.brandl at gmx.net
Sat May 23 18:54:20 CEST 2009


George Sakkis schrieb:
> On Fri, May 22, 2009 at 8:01 PM, Tarek Ziadé <ziade.tarek-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
>> On Sat, May 23, 2009 at 1:46 AM, Georg Brandl <g.brandl-hi6Y0CQ0nG0 at public.gmane.org> wrote:
>>>>
>>>> os.listdir(os.curdir)  <-> os.listdir()
>>>
>>> This seems to be a nice case of EIBTI to me.
>>
>> I would rather call that a default behavior, otherwise every function
>> with arguments that have default
>> values would be nice cases of EIBTI.

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.

> 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 :)

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list