Re:Black: An uncompromising Python code formatter
by weberc2 on Friday May 25, 2018 @10:07PM
(#17159749)
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. ;)
[ Parent
| on HN ]
Re:Black: An uncompromising Python code formatter
by vijucat on Saturday May 26, 2018 @03:37AM
(#17160710)
I'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
"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.
Re:Black: An uncompromising Python code formatter
by heavenlyblue on Saturday May 26, 2018 @06:01AM
(#17161206)
I’ve always thought that double quotes are for degenerates who don’t pay attention to what a standard repr output is for strings.
Re:Black: An uncompromising Python code formatter
by kuroguro on Saturday May 26, 2018 @08:43AM
(#17161723)
And I’ve always thought that triple quotes are for degenerates who... no, wait, nvm.
Re:Black: An uncompromising Python code formatter
by heavenlyblue on Saturday May 26, 2018 @08:46AM
(#17161733)
... who can’t write self-explanatory code.
Re:Black: An uncompromising Python code formatter
by nerdwaller on Saturday May 26, 2018 @10:14AM
(#17162115)
Code 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 ;)
Re:Black: An uncompromising Python code formatter
by aldanor on Monday May 28, 2018 @07:56AM
(#17171946)
You don't have to press Shift as often to type string literals so it's a win, all other things being equal.
Re:Black: An uncompromising Python code formatter
by rndgermandude on Saturday May 26, 2018 @01:12AM
(#17160346)
I 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
Re:Black: An uncompromising Python code formatter
by greyman on Saturday May 26, 2018 @07:50AM
(#17161546)
I 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.