[Python-ideas] os.listdir default to '.'
Mathias Panzenböck
grosser.meister.morti at gmx.net
Thu Jan 12 19:46:12 CET 2012
IIRC for Python 2 under Windows os.listdir(".") does something different than os.listdir(u".").
Because I think there are two filesystem APIs under Windows, one using char and the other wchar_t.
(I don't use Windows so I could be mistaken.)
But anyway, under any OS Python 2 returns something else whether you pass a unicode or str object to
listdir (a list of unicode or string objects). Under Python 3 there is no unicode because str is
what under Python 2 was unicode.
So under Python 2 os.listdir() would be not good. What should it return? strs or unicodes?
On 01/12/2012 04:02 PM, 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
More information about the Python-ideas
mailing list