The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
Posted Jul 31, 2018 20:54 UTC (Tue) by lsl (subscriber, #86508)In reply to: The Grumpy Editor's Python 3 experience by roc
Parent article: The Grumpy Editor's Python 3 experience
Posted Jul 31, 2018 22:03 UTC (Tue)
by k8to (guest, #15413)
[Link] (9 responses)
chmod u=rwx,go=rx
At least it's super clear compared to the C version.
But I still tend to use the C constants in code as opposed to octal numbers. I think it's a mix of expecting other programmers to come across it who are not UNIX nerds, and the fear of mangling the octal, and a bit of dogmatic fear over magic inline numbers.
Posted Aug 1, 2018 0:19 UTC (Wed)
by madscientist (subscriber, #16861)
[Link] (4 responses)
So, it could be "u" means the owner of the file and "o" means other users, or it could be that "o" means the owner of the file and "u" means other users.
Really, it's hard to imagine a worse pair of letters for sowing confusion. In fact the way it makes the most sense to me is exactly the opposite of reality: "o" should be "owner" and "u" should be general users.
That's why I prefer the numerical codes and consider them simpler to get right. Every time I need the text syntax (if I need to do something more sophisticated such as remove the w bit without touching other values) I have to go look up the man page to make sure I have it right. You definitely don't want to mess it up!!
Posted Aug 1, 2018 3:08 UTC (Wed)
by k8to (guest, #15413)
[Link]
Posted Aug 1, 2018 11:57 UTC (Wed)
by tao (subscriber, #17563)
[Link] (2 responses)
But I guess we all have different ways of remembering things.
Posted Aug 1, 2018 13:03 UTC (Wed)
by madscientist (subscriber, #16861)
[Link] (1 responses)
I already clearly (I think) explained the specific issue I had. I don't object to the text form, and as mentioned I do use it when I need to use the "+" or "-" forms of chmod for example. However I think poor design choices make it harder to use correctly and so I prefer the numeric system on the command line when possible. There's little possibility of mixing up the order of three numbers.
Please note I'm speaking here specifically of the "chmod" command line syntax.
Posted Aug 2, 2018 12:10 UTC (Thu)
by tao (subscriber, #17563)
[Link]
Posted Aug 1, 2018 15:50 UTC (Wed)
by rweikusat2 (subscriber, #117920)
[Link] (3 responses)
chmod 0755
u=rwx,go=rx has no inherent meaning. It's an arbitrary encoding of an integer using 'letters' and 'funny symbols' instead of numbers.
I stopped using the 'letters and funny symbols' encoding once I got over my prejudice that 'letters and funny symbols' are somehow 'inherently better' than numbers. For the octal encoding, 1 means execute, 2 means write and 4 means read (also 1 means sticky, 2 setgid and 4 setuid for the fourth set).
Posted Aug 1, 2018 20:47 UTC (Wed)
by marcH (subscriber, #57642)
[Link] (2 responses)
Those damn, so-called "letters"... I wish email addresses had allowed digits only, they would have been as easy to remember as phone numbers.
Posted Aug 1, 2018 21:42 UTC (Wed)
by rweikusat2 (subscriber, #117920)
[Link] (1 responses)
It's certainly not more complicated than remembering PINs or passcodes, something many people apparently do without problems.
It does take a conscious decision to do so, though.
Posted Aug 2, 2018 4:22 UTC (Thu)
by marcH (subscriber, #57642)
[Link]
Posted Aug 1, 2018 1:43 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Aug 3, 2018 16:44 UTC (Fri)
by mm7323 (subscriber, #87386)
[Link]
The reasons are simple and many.
1) giving things a name often help understanding
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
If you're familiar with the encoding, it's "clear" what it means, if you're not, you won't understand it. One could even call it misleading as go is an English verb which doesn't mean "group and other" (a phrase with doesn't mean anything in itself, either).
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
The Grumpy Editor's Python 3 experience
2) macros or constants provide a convenient place to hang documentation
3) you can easily grep for them to audit use
4) they provide a sort of type hint or type safety depending on language
5) you can Google them much more easily
6) macros can hide expressions or reliance on other macros which helps explain their derivation
7) you can change their definition at a later date without having to search or change lots of code sites
