-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Description
Feature or enhancement
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Proposal:
Hey.
stat.filemode() (which is IMO rather unfortunately named, as it doesn't return the actual file mode (bits) but just one of the string notations for it is quite helpful for many cases.
But I think the reverse function, that is converting a file mode in some string notation to the actual (binary) file mode, would also be nice to have as a convenience function.
Subsequently I'll provide a draft PR, that gives a poor man's example of how this could be done, re-using the existing stat._filemode_table.
The draft is based on what I use personally for this,… it would need to be further improved of course (see the PR, for what's missing).
But this should serve as a start so that Python core devs could decided whether they'd even want such a function at all in Pyhton.
Any opinions? :-)
Cheers,
Chris.