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

Rob Cliffe rob.cliffe at btinternet.com
Thu Jan 12 16:14:46 CET 2012


In Python 2.5 you can at least say os.listdir('') which had the same effect.
In Python 2.7 you can't.

Strictly speaking I think the default value should be os.path.curdir, 
not specifically '.'

+1 from me
+1 on allowing the empty string argument again (may avoid breaking some 
old code)

Rob Cliffe

On 12/01/2012 15:02, Michael Foord wrote:
> Hello all,
>
> I frequently use Python from the interactive interpreter as a shell. 
> It is a frequent, but mild, irritant that I have to type 
> os.listdir('.') instead of just os.listdir().
>
> How about making '.' a default argument for os.listdir ?
>
> All the best,
>
> Michael
>
> -- 
> http://www.voidspace.org.uk/
>
> May you do good and not evil
> May you find forgiveness for yourself and forgive others
>
> May you share freely, never taking more than you give.
> -- the sqlite blessinghttp://www.sqlite.org/different.html
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120112/f2d8c8de/attachment.html>


More information about the Python-ideas mailing list