[Python-ideas] PEP: Extended stat_result (First Draft)
Charles-François Natali
cf.natali at gmail.com
Tue May 7 13:58:47 CEST 2013
>> The permission bits are not a problem. I'm confident that the permission
>> bits are specified by POSIX, and thus cross-platform (haven't
>> double-checked though).
>
> They are not. What is specified, which you may be thinking of, is the
> meaning of a numeric argument to the chmod _command_, from which you can no
> more infer that the bits themselves are the same than you can for signal
> numbers vs. the seven numeric values specified as arguments to the kill
> command.
No, there are actually standardized:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
"""
Name Numeric Value Description
S_IRWXU 0700 Read, write, execute/search by owner.
"""
There's a *lot* of code which uses hardcoded permission values.
File types are another matter, and I wouldn't rely on hardcoded values too much.
But this problem will soon be solved by Christian's reimplementation
of the stat module, see http://bugs.python.org/issue11016
cf
More information about the Python-ideas
mailing list