Hi everyone,
What do you think about enabling a more friendly interface to chmod
information in Python? I believe that currently if I want to get chmod
information from a file, I need to do this:
my_path.stat().st_mode & 0o777
(I'm using `pathlib`.)
(If there's a nicer way than this, please let me know.)
This sucks. And then the result is then a number, like 511, which you then
have to call `oct` on it to get 0o777. I'm not even happy with getting the
octal number. For some of us who live and breathe Linux, seeing a number
like 0o440 might be crystal-clear, since your mind automatically translates
that to the permissions that user/group/others have, but I haven't reached
that level.
I would really like an object-oriented approach to chmod, like an object
which I can ask "Does group have execute permissions?" and say "Please add
read permissions to everyone" etc. Just because Linux speaks in code
doesn't mean that we need to.
And of course, I'd want that on the `pathlib` module so I could do it all
on the path object without referencing another module.
What do you think?
Ram.