3 ms·
The popularity of black makes it a Schelling point [0]. It's not my favorite code style. At some point before the enum module was added, I picked a habit of u
by MereInterest 5y ago
The popularity of black makes it a Schelling point [0]. It's not my favorite code style. At some point before the enum module was added, I picked a habit of using single-quote 'strings' for internal fixed strings and double-quote "strings" for human-readable messages. Black's formatting of strings to all use double quotes removes this distinction. But having some 95% solution can get 95% of people to agree to it, which is enough to avoid arguments that never reach a conclusion.
[0] https://en.wikipedia.org/wiki/Schelling_point https://en.wikipedia.org/wiki/Schelling_point
- solarmist 5y agoOh cool! I hadn't heard of that.
- MereInterest 5y agoIt's a really fun concept that helps explain and understand a lot of politics. That positions held by groups don't need to be internally consistent in the same way that an individual's positions (ideally) should be. For a group, they main instead represent a mutually agreeable compromise between internal divisions of a group. Sort of like how if you're ordering pizza for a group of friends, a safe bet would be to order two pizzas, one pepperoni and one veggie. It's not going to be everybody's favorite pizza, or may not be anybody's favorite pizza, but most groups wouldn't be too put off by the selection.
- Qub3d 5y agoInteresting, Black docs specifically calls out an option for users with that exact use case for mixing single and double-quoted strings (although they do recommend dispensing of it eventually): https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings https://black.readthedocs.io/en/stable/the_black_code_style/... > If you are adopting Black in a large project with pre-existing string conventions (like the popular “single quotes for data, double quotes for human-readable strings”), you can pass --skip-string-normalization on the command line. This is meant as an adoption helper, avoid using this for new projects.
- MereInterest 5y agoThank you, and I hadn't known about that. That sounds sort of like the options for Prettier that xigol mentioned, where they're maintained in order to get a wider user base, but not recommended as they fragment the long-term coding styles. At this point, I've accepted the double-quote strings and am trying to make a habit of using enums instead, but it's good to know that the options exist. [0] https://news.ycombinator.com/item?id=30132012 https://news.ycombinator.com/item?id=30132012