torchgeo icon indicating copy to clipboard operation
torchgeo copied to clipboard

Ruff: prefer single quotes over double quotes

Open adamjstewart opened this issue 1 year ago • 0 comments

I promise this is the single most controversial style change I will ever propose.

I hate double quotes. The only reason I've ever used double quotes is because black required them. Single quotes are better for the following reasons:

  • I don't have to press the Shift key as often
  • They are easier on the eyes, especially for short strings (in my opinion)
  • Python repr defaults to single quotes (print(repr("hello world")) displays 'hello world')
  • They don't have to be escaped in Jupyter Notebooks (yes, I edit those in vim)

Conversely, double quotes are better for the following reason:

  • Single quote apostrophes are more common than double quotes in text

However, both black and ruff default to " when ' is in the string, and vice versa. So this decision only affects strings that contain neither.

We will want to add this PR commit to .git-blame-ignore-revs after merging so that git blame still works correctly.

https://github.com/psf/black/issues/118 also contains some arguments for and against single and double quotes.

adamjstewart avatar Apr 16 '24 16:04 adamjstewart