[Python-Dev] Updates to PEP 471, the os.scandir() proposal

Ethan Furman ethan at stoneleaf.us
Wed Jul 9 22:44:12 CEST 2014

On 07/09/2014 01:24 PM, Victor Stinner wrote:
> Sorry, I didn't follow the whole discussion. IMO DirEntry must use
> methods and you should not expose nor document which infos are already
> provided by the OS or not. DirEntry should be a best-effort black-box
> object providing an API similar to pathlib.Path. is_dir() may be fast?
> fine, but don't say it in the documentation because Python must remain
> portable and you should not write code specific to one specific
> platform.

Okay, so using that logic we should head over to the os module and remove:

ctermid, getenv, getegid, geteuid, getgid, getgrouplist, getgroups, getpgid, getpgrp, getpriority, PRIO_PROCESS, 
PRIO_PGRP, PRIO_USER, getresuid, getresgid, getuid, initgroups, putenv, setegid, seteuid, setgid, setgroups, 
setpriority, setregid, setrusgid, setresuid, setreuid, getsid, setsid, setuid, unsetenv, fchmod, fchown, fdatasync, 
fpathconf, fstatvfs, ftruncate, lockf, F_LOCK, F_TLOCK, F_ULOCK, F_TEST, O_DSYNC, O_RSYNC, O_SYNC, O_NDELAY, O_NONBLOCK, 
O_TEXT, ...

Okay, I'm tired of typing, but that list is not even half-way through the os page, and those are all methods or 
attributes that are not available on either Windows or Unix or some flavors of Unix.

Oh, and all those upper-case attributes?  Yup, documented.  And when we don't document it ourselves we often refer 
readers to their system documentation because Python does not, in fact, return exactly the same results on all platforms 
-- particularly when calling into the OS.


More information about the Python-Dev mailing list