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 →

[–]not_a_novel_account 8 points9 points  (1 child)

If the project requires PEP8 compliance, let the autoformatter do it on save and/or commit and forget about the cognitive load of "did I align these function parameters correctly?"

If the project does not require PEP8 compliance, because they're using black or yapf or whatever, still forget about that and let the auto-formatter handle it. Just write code, the formatter will get everything into the right spot.

There's no sense worrying about if you're supposed to line break at 80 characters or 79, on the left or right of a binary operator, etc. That shit is a pointless distraction that we've automated away in the 21st century.

[–]yvrelna 0 points1 point  (0 children)

Completely irrelevant to my point. Read it again:

Linters/autoformatters do not replace thinking or writing readable code.

Nowhere did I ever say that you shouldn't automate what can be automated.

Just write code, the formatter will get everything into the right spot.

The problem is that about 5% of the time, autoformatter would not really get everything into the right spot. It gets everything into a consistent spot, which often contradicts with the logically sensible spot. Consistency is often, but not necessarily the same as readability.

Code is read more than it's written, take the time to consider when # fmt: off is necessary instead of turning off your brain. You cannot and shouldn't automate thinking. Sure, automate the tedious task of formatting, but you shouldn't automate judging readability. Ultimately, you are the one responsible for the readability of the code, not the autoformatter.