Hacker News new | ask | show | jobs
by Teongot 1604 days ago
Because "don't" is easier to read than 'don\'t'
4 comments

If you use proper apostrophes instead of ASCII apostrophe / single quote, you don’t have to escape anything and you get better typography. "don’t" is easier to read than both.

If you’re on a Mac, Option-Shift-] will type it.

When you’re embedding SQL in a string, a you use ‘ a lot more than “. Not the only use case, but one to give some consideration.
I think that’s only MySQL. Postgres uses double quotes for identifiers and single quotes for literals.

EDIT: I misinterpreted that single quote as a backtick. In any case, both single and double quotes are common in SQL, but single quotes are a bit more common.

Black will use single quotes if your string contains double quotes and no single quotes. It'll reformat

     print("\"Hello\" he said")
to

     print('"Hello" he said')
I think pretty much all formatters for languages that let you use either quote do this. It makes sense.
And 'do not' is easier to read than both :)