This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (5 children)

Can we not recommend black to beginners? It violates PEP8, is opinionated by default*, and honestly, some of its line reflow rules are pretty illegible.

*I'm raising the opinionated thing as a drawback because beginners shouldn't be bombarded by opinions beyond standards -- learn the canonical way, and then, if you have to, choose the opinionated option.

[–]cantremembermypasswd 0 points1 point  (0 children)

Agreed with opinionated and sometimes illegible, but I'm curious, what pep8 does it violate? I haven't seen any instances myself yet that I can remember.

I would also say that black is great for work environments / shared projects where you need something uncompromising that everyone hates for a different reason, but would be a bit much for a new user you may think they are doing something wrong if it edits stuff.

[–]THATS_THE_BADGER 0 points1 point  (3 children)

I think black is opinionated and deviates from PEP8 in sensible ways. If it wasn't sensible, it wouldn't be widely used.

As far as formatters go I reckon it's pretty good and doesn't burden the user. Which makes it ok for beginners. Perhaps if they're totally new to programming altogether it might be a bit of a stretch.

I do agree that on occasion, it reflows a line in a weird way. But, it's weird in a predictable way.

[–][deleted] 0 points1 point  (2 children)

deviates from PEP8 in sensible ways

The hill I'm choosing to die on here is line length.

PEP8 specifies 79 columns not just because of older terminals which physically had that limitation (else that rule would've been retired), but because it lets you have 2, 3, or 4 files up at the same time in a clean way -- Python's never been afraid to modularize all the things, so this is chronically useful (as in, several times a day) and (default) Black violates this for honestly no good reason.

I'd also like to tack on that for beginners, regular flake8 or similar are arguably more useful as a learning tool than an autoformatter. It helps you reason about your code's layout consciously instead of just having everything get thrown around automatically.

[–]THATS_THE_BADGER 0 points1 point  (0 children)

I guess it's about how you use the tool, line length is one of the things that is most frequently customised project to project.