3 ms·
The only successful formatter are ones who don't have any knobs to tune. The reason a formatter exists is to make all codebases look consistent, not to cater to
by hashhar 7y ago
The only successful formatter are ones who don't have any knobs to tune. The reason a formatter exists is to make all codebases look consistent, not to cater to your personal style.
This is one area Golang got it right with gofmt.
- Lutzb 7y agoThis is the reason we switched to black for Python about a year ago. There are no options to tweak. At first I had to deal with a lot of complaining developers, but now everyone got accustomed to blacks formatting style and we moved on.
- londt8 7y agoIt has questionable default of 88 characters per line, which is configurable. I wish they chose 79 characters as PEP8 suggests.
- zzzeek 7y agoThat is one of the few things you can set, put it in your pyproject.toml, done. Oh you don't have a pyproject.toml? Well then we have a different problem :)
- kstrauser 7y agoSame. It looked weird at first, and everyone had specific complaints with it, but they were all different complaints. Now we all accept that it’s just what Python code looks like, and can stop thinking about it all.
- closed 7y ago> The reason a formatter exists is to make all codebases look consistent I'm not how this is related to not having any knobs to tune. Aren't there many ways for code to be consistent with pep8? Isn't advocating for only one version of pep8-consistent code in essence an attempt to supercede pep8?
- dewey 7y agoThey are most likely talking about the codebase being consistent within a company / project. Not consistent with pep8. If there are no knobs to turn (like in gofmt) everyone just has the same settings and you don't have to make sure everyone sets the knobs to the same values.
- zzzeek 7y agoBlack formats to a subset of pep8 so I guess it's an attempt to "subcede" pep8.
- closed 7y agoI think that thing X superceding thing Y is equivalent to thing Y subceding to thing X. In this case, if black becomes the standard for defining appropriate style then it is superceding pep8 as the standard for style (many styles consistent with pep8 are not black outputs, so if black's style becomes mandatory, it is a ruling against these previously accepted alternatives).