[Python-Dev] stat module in C -- what to do with stat.py?

Christian Heimes christian at python.org
Fri Jun 21 14:21:13 CEST 2013


Am 21.06.2013 13:45, schrieb Antoine Pitrou:
> For me, PEP 399 should not be considered a requirement but a guideline.
> stat.py is algorithmically trivial and I don't think it saves much work
> for authors of third-party Python implementations.

The module's content is rather boring. It's just a bunch of constants,
some wrapper functions for macros and one trivial function that turns
st_mode into "-rwxr-xr-x" string.

In my opinion stat module falls into the same line as the errno module.
The latter is also implemented in C in order to pull a bunch of
constants from header files.

I have yet another argument in favor of a C implementation. POSIX
standards won't gain any new S_IF* numeric constants for new files
types. Some file types such as mq, semaphore, shmem and typed memory
from POSIX real time extensions aren't testable with S_IF*, too. (But I
don't know any platform that implements them as files, though).
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html#tag_13_61_06

Christian



More information about the Python-Dev mailing list