Yes, Use Black for Python

2022-01-29

Black, the opinionated Python code formatter, has just made its first stable release (via HN). It still makes code changes that I don't like, but it's good enough that I no longer think about formatting.

I think this is still underrated. Coding is a mix of craft, logic, and aesthetics, and the outstanding programmers I know of all have strong opinions on all three of these. But code is ultimately an artifact to be read and shared, whether by your collaboraters or your future self. Basic consistency helps enormously when getting up to speed again. It's like having consistent font sizes and line spacing when reading text.

Looking forward, I wonder what other kinds of similar tools will become part of daily development. The HN comments mention μsort, which is a nice next step. Maybe we'll see better tools for flagging long functions, complex dependencies, poor test coverage, or clumsy variable names. GitHub Copilot is in the right direction, but I would rather have a smart tool than a dumb collaborator.