Double quotes are also the convention in english to delineate a literal, so I would argue it's more obvious.
I'll grant you keyboard presses though. There's an obvious advantage to single quotes here, but consider why this is the case. To make the use of "apostrophe" more efficient since it appears far more often than a double quote in english. I suppose it's pragmatic to leverage this advantage in code where string quoting is extremely common...
Perhaps double quoting is a bias I've developed writing code, but I suspect it's actually a bias I carried over from reading and writing english and what simply seemed more obvious.
Language design than supports both makes me crazy. Pick one and enforce it!
The visual noise complaint is interesting. Do you also consider the letter W to be more noisy than the letter V? Should we discourage the use of noisy letters in the alphabet?
I thought the same. I guess you could just modify your programming font to make the double quotes really tiny :)
The difference is that " and ' are equally usable options in the context we're talking about. Quotes are very common, so the visual noise adds up when your screen is full of quote marks. Given that they mean the same thing, and one is both harder to type and harder to read, it makes sense to prefer the other.
Nailed it.
raise KeyError('"%s" not found.' % name)
f'The flange is elevated by {flange["spronge"]} degrees of spronge.'
I don't normally use many contractions or possessives in my code, but am willing to admit it happens occasionally.
I'd like «guillemets» but that's going to have to be self-serve...
set_color('black','white')
And double quotes for strings meant to be read by a human: print("Hello there. How are you?")
And an example with both forms: syslog('warning',"unit %s spin rate %f too low",u,rate)
For me, it's an indication of how I expect the string to be used.PHP does treat single and double quotes differently. Contents of single quotes strings are not parsed for variable substitution.