DEV Community


Discussion on: Enforcing single quotes in Python

rhymes profile image

I use black and I'm fine with the double quotes. From their documentation:

Why settle on double quotes? They anticipate apostrophes in English text. They match the docstring standard described in PEP 257. An empty string in double quotes ("") is impossible to confuse with a one double-quote regardless of fonts and syntax highlighting used. On top of this, double quotes for strings are consistent with C which Python interacts a lot with.

On certain keyboard layouts like US English, typing single quotes is a bit easier than double quotes. The latter requires use of the Shift key. My recommendation here is to keep using whatever is faster to type and let Black handle the transformation.


they explain there's a way not to enforce quotes normalization using --skip-string-normalization but I've never tried it.

You can also use it with flake8 if you want to go further in syntax checking:

My recommendation is to surrender to the double quotes :D