[Python-ideas] class os.DirEntry is confusing,

Victor Stinner victor.stinner at gmail.com
Sat Mar 21 11:23:26 CET 2015


Hi,

The "DirEntry" name comes from the POSIX structure "direntry". You should
not instanciate the DirEntry class nor store it, so not check its type
neither (isinstance(something, os.DirEntry)). I don't think that the exact
name of the class matters. I had prefer DirectoryEntry, but "dir"
shortcut is common in the Python os module (os.listdir) and in POSIX
strandard (opendir, struct direntry).

You are coming late. The PEP was discussed during 3 months (may-july 2014),
and Ben started to work on it since 2012! See the PEP for details:
https://www.python.org/dev/peps/pep-0471/#naming

I accepted the PEP and I don't plan to modify it even if you have a serious
rationale for the change. Bikeshedding is not :-) By the way, the PEP is
implemnted. os.scandir() is already in the latest python 3.5 alpha.
Optimized os.walk() will be in the next alpha.

Victor

Le vendredi 20 mars 2015, 罗勇刚(Yonggang Luo) <luoyonggang at gmail.com> a
écrit :

> Should be replaced with os.FsEntry or os.ScanEntry
>
> --
>          此致
>> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org <javascript:;>
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150321/41d56935/attachment-0001.html>


More information about the Python-ideas mailing list