27
How long is your Maximum Line Length for PEP 8?
Limit all lines to a maximum of 79 characters.
I used to follow this guide and set the default value to 79 characters in Lint.
However, the readability was sometimes compromised to comply with this, so I decided to reread the guide and tune the setting values.
Some teams strongly prefer a longer line length. For code maintained exclusively or primarily by a team that can reach agreement on this issue, it is okay to increase the line length limit up to 99 characters, provided that comments and docstrings are still wrapped at 72 characters.
The rationale for the 79 characters is described as follows.
Limiting the required editor window width makes it possible to have several files open side by side, and works well when using code review tools that present the two versions in adjacent columns.
The default wrapping in most tools disrupts the visual structure of the code, making it more difficult to understand. The limits are chosen to avoid wrapping in editors with the window width set to 80, even if the tool places a marker glyph in the final column when wrapping lines. Some web based tools may not offer dynamic line wrapping at all.
I see.
Also, in A Foolish Consistency is the Hobgoblin of Little Minds there is a section that says
However, know when to be inconsistent -- sometimes style guide recommendations just aren't applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!
VisualStudioCode and PyCharm defaulted to 120 characters per line.
Interestingly, they seem to be derived from typewriters and punch cards.
So, I changed the Maximum Line Length to 90 for the time being because, in our team's standard editors, about 90 characters can be displayed in the one tree tab + two editor tabs.
It's been a couple of months now, and I'm glad I changed it.
I'm thinking of changing it to 99 characters after seeing how it goes.
27