3 ms·
Yes, that must be right, although to me the trade-off is escaped strings which lack good aesthetics. 'The class of \'72 didn\'t think much of Sam\'s speech' v
by wenc 6y ago
Yes, that must be right, although to me the trade-off is escaped strings which lack good aesthetics.
'The class of \'72 didn\'t think much of Sam\'s speech'
vs
"The class of '72 didn't think much of Sam's speech"
To me, the shift chord is an almost negligible price to pay for more aesthetically pleasing strings, especially since on a QWERTY keyboard, the shift key is literally right next to the ' key. For emacs users who are used to complex key chords, it's even more negligible.
I do use single quotes for strings frequently in interpolated f-strings though:
f"The date is {result['year']}"