- Most lines are short even if the limit is more than 80 characters, so you're unlikely to accidentally shift up or down after reading a long line.
- Even if there turns out to be some benefit for reading code based on Saccades, that means nothing unless you can make some quantitative comparison with the other advantages and disadvantages of a longer line length.
80 charcters starting at the point of indentation is more reasonable. At two levels of indenting, you might get out to 96 characters, which still fits comfortably in most GUI terminal windows.
When reading code, I'd rather see a single statement on one line, rather that break it at 2 lines because it passed some ancient 80 char limit...
I don't care if a line needs to be 180 chars if it starts with log.debug. Just like searching, I read my code globally based on the first 10-20 chars. If I need details on a line, I'll read the whole line.
I do however put chained methods on new lines, because they are often a new statement.
And I use 4 spaces for indent, because my IDE is smart enough, it is in my programming language guidelines, and that's what my comapny uses.
So can simple arithmetic that would be worse with intermediate values.
No, but it means we better use rubber wheels, not stone ones...
Oh wait, we use wheels sized for their use cases…
PEP8 is strongly biased towards making code readable, and has helped a generation of programmers start thinking about readability when coding. The line length limit, though, is one of the few parts of PEP8 that introduced defects as a practice. Holding to 80 characters causes:
* string concatenation bugs from breaking up long strings
* errors in expressions broken up into multiple expressions just to fit
* bias to use shorter variable names
My favorite part of PEP8 was the warning about "foolish consistency".
Which also happens to be how Linus wrapped the lines of this particular email.
> Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.
Some arguments in favour of longer lines would be:
- monospaced fonts are relatively wide so the line is not long in terms of the number of characters
- there can be a lot of non-length on the left hand side due to indentation (especially in Linux where tabs are wide)
- programmers are relatively literate and so might perform better than average at finding the start of the line
- editor features like line highlighting can help to find the line
- source code has a very ragged edge and so it is easier to find the start of the line than in dense prose.
- magazines or their readers prefer narrow columns for stylistic reasons. E.g. newspapers sometimes have very narrow columns that lead to intraword spacing that makes things hard to read
2) The 80 or 66 char or whatever is literally a non-science driven designer rule of thumb that's actually the opposite conclusion from results of actual research into the issue (granted it's not exactly a deeply studied niche but there is research).
E.g. if you have 4 long lines all following the same pattern with minor modifications, the best way to both scan quickly and avoid bugs is to write them on their own line fully and align the common parts vertically.
Splitting each line into smaller parts for the sake of "vertical scanning" actually achieves exactly the opposite in this case.
80 characters happens to be just a little longer than the supposedly ideal measure for continuous text promulgated by Robert Bringhurst.[2]
I take the even more draconian approach of wrapping to 72 columns when writing comments, after the fashion of PEP 8.[3]
Of course, Linus will dictate the style of his projects' codebases as he deems fit.
[1]https://en.wikipedia.org/wiki/Saccade
[2]http://webtypography.net/2.1.2
[3]https://www.python.org/dev/peps/pep-0008/#maximum-line-lengt...