Leading 0's syntax error in datetime.date module (Python 3.6)

Chris Angelico rosuav at gmail.com
Fri May 11 09:14:37 EDT 2018


On Fri, May 11, 2018 at 8:08 PM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
>>
>> What do you mean, "another bit"? Currently, the chmod command on my
>> system can manage nine primary bits (rwx for each of ugo), plus
>> setuid, setgid, and sticky.
>
>
> I think the idea is that you could regroup those 4 groups
> of 3 into 3 groups of 4, and get a nice mapping to hex.
> If hex had been the conventional way of writing binary numbers
> back then, Ken and Dennis would probably have done it that
> way.

But they aren't "four groups of three" that could be reorganized.
They're three groups of three, plus three separate bits. Each group of
three is the permissions for one category of user (the owner, anyone
in the owning group, or everyone else). If your permission set is 6,
you may read and write, but not execute. If it's 4, you may only read.
5 lets you read and execute. 0 denies everything. What other bit would
you add? Tack setuid onto "owner", setgid onto "group", and sticky
onto "others"? Pretty arbitrary, and disrupts the fundamental meaning
of each set. (Plus, it still ignores the "is-directory" and "is-link"
bits, etc.)

> Changing it now would require some fairly intimate surgery
> on unix, however, which is somewhat beyond the scope of
> what Python can achieve.
>

Yes, and wouldn't improve either Unix or Python.

ChrisA



More information about the Python-list mailing list