Code Formatter Questions

dn PythonList at DancesWithMice.info
Mon Mar 29 16:18:14 EDT 2021


On 29/03/2021 23.15, Matt Wheeler wrote:
>> On 29 Mar 2021, at 04:45, Cameron Simpson <cs at cskk.id.au> wrote:
>>
>> yapf has many tunings. Worth a look. It is my preferred formatter. By 
>> comparison, black is both opinionated and has basicly no tuning, 
>> something I greatly dislike.
> 
> This is not a mark or a vote against yapf (I’ve never used it), but I think Black’s lack of tuning is one of its greatest strengths.
> I’ve found in 2 teams in 2 very different companies, implementing `black —check` in CI made the code review process significantly more pleasant for both reviewers and review-ees.
> 
> I don’t know for sure, but I think the opinionated nature of Black was what enabled us to actually get the implementation off the ground (in company 1 several other attempts to get a code formatter running across the board had failed over the years). We completely sidestepped any discussion about which features of $tool were going to be enabled or not.
> 
> Black has a couple of minor opinions that I disagree with, but the net benefit of having everyone producing code in the same style (and importantly no-one having to *think* about the style while coding) vastly outweighs any annoyance I might have with those minor points, to the extent that I can’t actually remember what those disagreements are.


+1 (although not for Black - sorry)

Very good point: I'd much rather you spent time helping me with a
design/coding problem, helping debug, and/or reviewing/improving my code
(and I for you); than we had not time left-over after spending many
hours and much mental energy arguing about whether this format is [more]
right than that!
-- 
Regards,
=dn


More information about the Python-list mailing list