-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revisit not using Pythonic single quotes #373
Comments
There is |
Another point in favor of preferring single quotes to double quotes is that's what Python itself prefers:
In my opinion, that's the strongest argument for why black should prefer single quotes. This disparity has actually caused an issue in one project. I don't currently have a reference, but if I run across it again, I'll link back here. |
The main advantage of using a code formatter is that it forces the same formatting. The main advantage of using Personally, the decision to use double-quotes seems really "pig-headed" to me (for ignoring Python historical convention), but as anyone can see, the Pragmatically, the benefit of having consistent, enforced code formatting outweighs any trivial tastes I or my team have developed over the years. Will I use Until then, it's "good enough." Well done, |
The skip option is clearly useful to make adoption easier by delaying normalization for later. I was wondering myself why double vs single and I found some explanation that makes sense:
So there are some reasons. When it comes to |
Unfortunately, Black's insistence to not add a single quote option is a deal breaker for me as well. I work on several projects that settled on using single-quotes a long time ago, and we strive for consistency. Changing our projects from single quotes to double quotes will not happen easily. And, because we want to enforce single quotes, Thus, I literally cannot use Black for the time being. |
@psavery You can use
You can use it to chain the Black and |
It seems single quotes are most widely used and agreed on in the Python community. Judging by many years of experience along with the various issues listed on this repo. Whatever the reason for it is irrelevant, more people prefer single. It's a shame since @ambv wrote this little library then he gets to just wade in and close every issue about it saying in a round-about way "I personally prefer double quotes so no thanks". How a project with such a dictatorial regime gets listed under "https://github.com/psf/" is beyond me. Maybe this will improve in the future 🤞 |
This. |
This is a bad argument. You are using an auto-formatter. Type whatever is faster on your keyboard and let the tool auto-format it for you. There are no additional points for pre-formatting code manually to look exactly as Black would format it. There are no additional points for hanging onto closed issues, either. I'm locking this. |
I was considering letting black format the project code but enforcing double-quotes is a major red flag and honestly shocked by this decision.
Single quotes are Pythonic and have become the defacto standard in recent years, many code checkers (e.g. [flake-quotes]) and standards (e.g. Plone) default/request single quotes. Just because other programming languages use double is not a reason to try to strongarm a different practice onto Python codebases.
Typing single quotes are faster due to not needing to use shift.
It will convert huge swaths of project code for no benefit and negatively effect code history. I know this because I converted from double to single for a large project and was much harder to review code history. Was any consideration made for the number of Python projects using double or single quotes?
You say this project is still in beta so you still have time to change this. Just look at the responses in #118, the community is not happy with this decision, giving quite valid reasons. Skipping checking the quotes is not a good solution as it will result in mixed quotes which is much worse.
I am certainly not asking for the arbitrary mix of double and single depending on intention. Double is only reserved for docstrings or where a single quote is needed in a string.
Please just enforce single quotes as the Python community has mutually agreed upon.
The text was updated successfully, but these errors were encountered: