Re:Greppability is an underrated code metric
by pushfoo on Tuesday September 03, 2024 @03:51PM
(#41438497)
My understanding of black is that it solves bikeshedding by making everyone a little unhappy.
For aligned column readability and other scenarios, # fmt: off and # fmt: on become crucial. The problem is that like # type: ignore, those start spreading if you're not careful.
Re:Greppability is an underrated code metric
by kragen on Tuesday September 03, 2024 @04:05PM
(#41438653)
yeah; unless your coworkers are hindu, you can solve 'bikeshedding' about which restaurant to go to by going to mcdonald's, too
Re:Greppability is an underrated code metric
by sgarland on Tuesday September 03, 2024 @07:37PM
(#41440395)
My only complaint with black is that it only splits long definitions into per-line if they exceed a limit. That’s probably configurable, now that I write it down.
Other than that, I actually quite like its formatting choices.
Re:Greppability is an underrated code metric
by pushfoo on Tuesday September 03, 2024 @09:35PM
(#41441030)
Line length is definitely configurable. All it takes is adding the following on pyproject.toml[1]:
[tool.black]
line-length = 100
Aside from matrix-like or column aligned data, the only truly awful thing I've encountered has been broken f-string handling[2].[1]: Example from https://github.com/pythonarcade/arcade/blob/808e1dafcf1da30f...
Re:Greppability is an underrated code metric
by lkbm on Tuesday September 03, 2024 @05:54PM
(#41439679)
Fair. I spent some time trying to figure out how to make it do roughly that before giving up.
Re:Greppability is an underrated code metric
by kragen on Tuesday September 03, 2024 @07:30PM
(#41440352)
i kind of get the vibe from the black documentation that it's written by the kind of person who thinks we're bad people for wanting that, and perhaps that everyone should wear the same uniform because vanity is sinful and aesthetics are frivolous
> If a data structure literal (tuple, list, set, dict) or a line of “from” imports cannot fit in the allotted length, it’s always split into one element per line.
i'm not interested in minimizing diffs. i'm interested in being able to see all the fields of one record on one screen—moreover, i'd like to be able to see more than one record at a time so i can compare what's the same and what's different
black seems to be designed for the kind of person who always eats at mcdonald's when they travel because they value predictability over quality