4 ms·
I prefer a quoting convention of single quotes for text identifiers (as they rarely contain quotes) and double quotes for English text (because contractions are
by stevesimmons 8y ago
I prefer a quoting convention of single quotes for text identifiers (as they rarely contain quotes) and double quotes for English text (because contractions are common). Thus:
key['first_name']
print("Isn't this clearer?")
- gvx 8y agoI generally follow this convention: 1. Any string literal that contains either ' xor " will be delimited by the other one. 2. For all other string literals, delimit by " if it's meant for human eyes only, delimit by ' if it's meant for computers as well.
- masklinn 8y agoSame, though I'd word the first one as programmatic identifiers. Adopted that from Erlang, where atoms are single-quoted and text strings are double-quoted.