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

Christian Heimes christian at python.org
Mon May 6 14:50:29 CEST 2013


Am 06.05.2013 10:30, schrieb Pieter Nagel:
> Abstract
> ========
> 
> This PEP proposes extending the result of ``os.stat()``, ``os.fstat()`` and
> ``os.lstat()`` calls with added methods such as ``is_file()``.  These added
> methods will obviate the need to use the ``stat`` module to interpret the
> result of these calls.

A side note:

The stat module has a flaw. It's a pure Python module with hard coded
constants. So far this has worked on all known platforms because the
platforms are all using the same constants with equal meaning. AFAIK the
POSIX specs only specify the names of the constants but not any values.

I'm planing to make the stat module a built-in.
http://bugs.python.org/issue11016 contains a first draft. In order to
test the code you have to add "stat statmodule.c" to Modules/Setup and
run ./configure && make.

Christian




More information about the Python-ideas mailing list