[Python-ideas] PEP: Extended stat_result (First Draft)

Pieter Nagel pieter at nagel.co.za
Mon May 6 16:21:51 CEST 2013


On Mon, 2013-05-06 at 15:26 +0200, Christian Heimes wrote:

> How is your code going to work?.

At the moment both os.stat() and stat_result are implemented in C, and I
have to keep the option open that the work I do may need to be done in C
as well. I've written C extensions to Python before that reference types
defined in plain .py files, but I'm not sure if that's idiomatic or
permitted in CPython, so I have to keep my options open.

> On POSIX you *have* to rely on the
> functions in the stat module. They are the only and authoritative way to
> interpret the meaning of st_mode

Technically, the definitions of the S_IS* macros in the C header files
are the only authoritative way to interpret st_mode, the Python stat
module is not a normative part of POSIX at all ;-)

If I'm forced to implement in C, I'll use the POSIX libc macros. If I
implement in python, I'll use the existing stat module, and benefit from
your patch when it is accepted.

-- 
Pieter Nagel





More information about the Python-ideas mailing list