News for hackers. Stuff that matters.
Re:If I could amend PEP 8 by Daishiman on Monday January 23, 2017 @02:05AM (#13460411)
With regards to string quotes, I've always used this idiom, which I find fantastic:

For strings that are meant for human consumption, use double quotes, otherwise use single quotes.

This is super practical when looking strings meant for translation, end-user formatting, and such.

Re:If I could amend PEP 8 by thebspatrol on Monday January 23, 2017 @03:09AM (#13460652)
I love this. I've always followed this guideline without thinking about how to communicate it.

I'm fairly sure that single quotes are much more common in the UK in literature, though, so this only feels like it makes sense to NA and AU speakers.

Re:If I could amend PEP 8 by OJFord on Monday January 23, 2017 @03:20AM (#13460702)
> I'm fairly sure that single quotes are much more common in the UK in literature, though

It's just that the primary/secondary role is reversed. (This is also reflected in which one you have to hold Shift for on a computer keyboard.)

Re:If I could amend PEP 8 by masklinn on Monday January 23, 2017 @03:37AM (#13460760)
I like that Erlang more or less enforces that rule: strings are double-quoted, symbols are single-quoted, you generally use symbols for "programmatic strings".
Re:If I could amend PEP 8 by thesmallestcat on Monday January 23, 2017 @03:46AM (#13460787)
[$i, $n, $d, $e, $e, $d].
Re:If I could amend PEP 8 by dozzie on Monday January 23, 2017 @05:09AM (#13461112)
ITYM: [$i|[$n|[$d|[$e|[$e|[$d]]]]]].
Re:If I could amend PEP 8 by rvirding on Tuesday January 24, 2017 @08:48AM (#13471226)
Yes "Indeed".
Re:If I could amend PEP 8 by js8 on Monday January 23, 2017 @03:11AM (#13460659)
Funny, I came here to suggest the same thing. It's a good rule.
Re:If I could amend PEP 8 by akvadrako on Monday January 23, 2017 @03:51AM (#13460816)
It's not a good rule because nobody else uses it, so it's just going to make the code inconsistent when someone else works on it.
Re:If I could amend PEP 8 by js8 on Monday January 23, 2017 @05:07AM (#13461109)
All good rules started by nobody else using it. Though, in this case, at least three people discovered that rule independently.
Re:If I could amend PEP 8 by viraptor on Monday January 23, 2017 @06:50AM (#13461523)
And +1. I thought it's just me. It works quite well in practice and can be applied to many languages. Unfortunately in quite a few of them out prevents interpolation, so it's not a 100% solution.
Re:If I could amend PEP 8 by masklinn on Tuesday January 24, 2017 @11:39AM (#13472875)
> Unfortunately in quite a few of them out prevents interpolation, so it's not a 100% solution.

A bigger issue IME is languages (mostly of the C family) where single-quoting is for character literals.

Also in Smalltalk comments are double-quoted, but that's a pretty rare language to encounter.

Re:If I could amend PEP 8 by Grue3 on Monday January 23, 2017 @07:50AM (#13461813)
A lot of people use it. That's how I was taught to write Python and that's how I wrote it in several different companies. At my current job we use double-quotes for everything though (for some reason).
Re:If I could amend PEP 8 by jsmeaton on Monday January 23, 2017 @05:17AM (#13461147)
I do. People I work with do. People I mentor do.