News for hackers. Stuff that matters.
Re:Format Python Code Using YAPF by hashhar on Sunday February 09, 2020 @05:58AM (#22281509)
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.

Re:Format Python Code Using YAPF by Lutzb on Sunday February 09, 2020 @06:04AM (#22281521)
This 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.
Re:Format Python Code Using YAPF by kstrauser on Sunday February 09, 2020 @12:52PM (#22283305)
Same. 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.
Re:Format Python Code Using YAPF by londt8 on Sunday February 09, 2020 @06:26AM (#22281587)
It has questionable default of 88 characters per line, which is configurable. I wish they chose 79 characters as PEP8 suggests.
Re:Format Python Code Using YAPF by zzzeek on Sunday February 09, 2020 @01:09PM (#22283398)
That 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 :)

Re:Format Python Code Using YAPF by closed on Sunday February 09, 2020 @09:25AM (#22282230)
> 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?

Re:Format Python Code Using YAPF by dewey on Sunday February 09, 2020 @12:30PM (#22283204)
They 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.

Re:Format Python Code Using YAPF by zzzeek on Sunday February 09, 2020 @01:11PM (#22283412)
Black formats to a subset of pep8 so I guess it's an attempt to "subcede" pep8.
Re:Format Python Code Using YAPF by closed on Sunday February 09, 2020 @06:36PM (#22285111)
I 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).