News for hackers. Stuff that matters.
Re:Django: Reformatted code with Black by belval on Tuesday February 08, 2022 @10:24AM (#30259455)
Indeed, I don't like Black's style, but I prefer working in a Black codebase than one where everyone has their own preference. Having style guidelines in a team is also a great way to remove pointless debates when reviewing PRs.
Re:Django: Reformatted code with Black by daenz on Tuesday February 08, 2022 @10:47AM (#30259782)
Agreed, and what's interesting is that despite all of those pointless style debates, there hasn't been much pushback on using reformatters (that I've seen). This tells me that the debates weren't really about "my style is objectively best" but more about "I'd like to use a consistent/predictable style (with preference to mine)."
Re:Django: Reformatted code with Black by belval on Tuesday February 08, 2022 @10:54AM (#30259900)
Quite right, I have not met a lot of people that were actually strongly opinionated about their coding style. They simply did not want to use a tribal one that was not well defined that just added friction to the development process.
Re:Django: Reformatted code with Black by declnz on Tuesday February 08, 2022 @10:28AM (#30259530)
+1

...which is why I wish Black allowed more configuration. A team can often agree on a set of styles. Every team on the Python planet agreeing... now that's much harder

Re:Django: Reformatted code with Black by belval on Tuesday February 08, 2022 @10:59AM (#30259970)
I disagree on that though. By sticking to vanilla Black (no pun intended) you ensure that people joining your time will probably already be familiar with the style, you prevent strongly opinionated employees from pushing for changes in the linter config.

Black is opinionated, so it skips the debate entirely. We just use Black, not black with 120 characters lines, just Black.

To each their own I guess, but to me it just seems like pandora's box. Once you show that you are open to changes in the linting configuration, it makes the rules mutable and pretty much guarantees that at some point someone will say "how about we just change this one parameter in the linter", which will probably be agreed by the rest of the team, not because they actually agree but because they don't want to argue.

Re:Django: Reformatted code with Black by spc476 on Tuesday February 08, 2022 @08:17PM (#30267341)
Yes, it's opinionated, but who's opinion got carved into stone?
Re:Django: Reformatted code with Black by belval on Wednesday February 09, 2022 @10:11AM (#30273504)
That does not really matter as long as the default are somewhat sensible. As far as I can tell Black's are.

gofmt is also opiniated. Someone somewhere picked the defaults and maybe I disagree with those defaults, but in the grand scheme of things, all go code is more approachable because it all looks the same. That to me, is worth a lot more than having my favorite format be the one on top.

EDIT: If you want to discuss the actual merits of Black, you can read their style page that actually explains every choice they made: https://black.readthedocs.io/en/stable/the_black_code_style/...

Re:Django: Reformatted code with Black by frosted-flakes on Tuesday February 08, 2022 @10:13PM (#30268295)
Does it matter?
Re:Django: Reformatted code with Black by spc476 on Wednesday February 09, 2022 @03:58AM (#30270513)
Well, someone convinced the Python community that their coding standard should be the one coding standard.
Re:Django: Reformatted code with Black by pinkman68419 on Tuesday February 08, 2022 @11:43AM (#30260667)
The etymology of black is "any color you like, as long as it's black" [0]. The whole point is that it's _not_ configurable.

[0] https://github.com/psf/black#readme

Re:Django: Reformatted code with Black by heavenlyblue on Tuesday February 08, 2022 @10:31AM (#30259568)
> A team can often agree on a set of styles.

What for? Just to be clear even Django itself isn't obviously using a configuration, what makes your team so special they need this?

Re:Django: Reformatted code with Black by dumdumdumdum on Tuesday February 08, 2022 @05:28PM (#30265754)
Re:Django: Reformatted code with Black by throwaway894345 on Tuesday February 08, 2022 @11:30AM (#30260443)
More configuration would allow for more fragmentation...
Re:Django: Reformatted code with Black by harikb on Tuesday February 08, 2022 @10:49AM (#30259807)
> A team can often agree

this usually just means new team members are stuck respecting the wishes of the old-timers

Re:Django: Reformatted code with Black by david422 on Tuesday February 08, 2022 @11:55AM (#30260876)
Yea, but in this case the old timers have chosen Black so what's the difference?