4 ms·
I’m a Python programmer and I never had the perception that single quotes are more canonical in any capacity. I always felt that single quotes were for degenera
by weberc2 8y ago
I’m a Python programmer and I never had the perception that single quotes are more canonical in any capacity. I always felt that single quotes were for degenerates who didn’t realize that single quotes are most commonly used for chars by the broader programming community. ;)
- rndgermandude 8y agoI despise people using single quotes even more than people using tabs instead of space, emacs instead of vim or GNU-style indentation instead of... anything sane :D
- greyman 8y agoI used to use single quotes for dictionary keys and other constants, and double quotes for strings intended to be read by human. I read some article about it a considered it a good convention. Now I see it actually isn't a convention. :-) I switched to black just yesterday and overall I like it, still I miss a bit this distinction between single and double quotes.
- deleted 8y ago[deleted]
- vijucat 8y agoI've seen single quotes for chars vs. double quotes for Strings in Java, but in sh, it's "Strong Quoting with Single Quotes" vs. "Weak Quoting with Double Quotes": http://www.grymoire.com/Unix/Quote.html#uh-1 http://www.grymoire.com/Unix/Quote.html#uh-1 "When you need to quote several character at once, you could use several backslashes. This is ugly but works. It is easier to use pairs of quotation marks to indicate the start and end of the characters to be quoted. Inside the single quotes, you can include almost all meta-characters" So some of us associate single quotes with proper const strings, with no variable expansion, command substitution or other interpreter hanky-panky.
- heavenlyblue 8y agoI’ve always thought that double quotes are for degenerates who don’t pay attention to what a standard repr output is for strings.
- kuroguro 8y agoAnd I’ve always thought that triple quotes are for degenerates who... no, wait, nvm.
- heavenlyblue 8y ago... who can’t write self-explanatory code.
- nerdwaller 8y agoCode only captures the what and the how, comments for any complex routines can capture the why. Obviously overuse is probably a red-flag, but in my experience code alone doesn’t always capture enough context in any sufficiently complex system. I get your specific comment may be a bit sarcastic, given the ancestry - but I make this one more for younger developers I see that don’t always filter that ;)
- aldanor 8y agoYou don't have to press Shift as often to type string literals so it's a win, all other things being equal.