Re:Black: An uncompromising Python code formatter
by bpicolo on Friday May 25, 2018 @03:30PM
(#17157082)
> More importantly, a low column limit is helpful to disabled engineers who don't have to navigate horizontally so much.
I saw that you mentioned that - where have you seen a study that claims 100 is the cutoff? Would be interested in seeing that.
Re:Black: An uncompromising Python code formatter
by ambivalence on Friday May 25, 2018 @04:00PM
(#17157356)
I don't have a formal study, just conversations with several legally blind engineers I work with.
Re:Black: An uncompromising Python code formatter
by B1FF_PSUVM on Friday May 25, 2018 @04:26PM
(#17157616)
> Originally PEP 8 had 79 characters. Now that was a weird choice so most companies went with 80 instead
Probably thinking of one of these:
- backslash continuations
- terminals/etc that counted newlines
- off by one errors
Re:Black: An uncompromising Python code formatter
by Izkata on Friday May 25, 2018 @08:13PM
(#17159242)
Also possibly a terminal text editor - the cursor sits on the column where the next character would be input (such as vim's insert mode). So with 79 character lines, the cursor is sitting at 80 while waiting for the next input.
If your screen is larger than that it's no big deal, but if your screen is 80 columns and the cursor was at column 81, it would wrap to the next line without actually being a newline.
So we used 80. I always felt bad when the linter stopped people from pushing impactful changes because they went over the limit by two characters. So two years ago I set up a "highway speed limit" style warning in flake8 (code B950 in PyCQA/flake8-bugbear). What it does is it keeps your limit intact (for example "80") but doesn't trigger unless you went over by more than 10%. So the limit happens to be 88.
When I was working on Black, I was faced with a dilemma. Should the formatter stick to 80 or be able to "go over" a bit, too, as we would let humans do. I felt like the latter made more sense as the resulting code looks nicer (fewer occasions to break a single line into three or more). Then I remembered Raymond's talk "Beyond PEP8" where he mentions that experience shows "90-ish" is the wisest choice. So I went with it.