This content originally appeared on DEV Community and was authored by Shuichi
Style Guide
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!
Note
IDE defaults
VisualStudioCode and PyCharm defaulted to 120 characters per line.
Other Languages
Characters per line - Wikipedia has a good summary.
There are many languages with 80 characters.
Interestingly, they seem to be derived from typewriters and punch cards.
How long is my Maximum Line Length for PEP 8?
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.
This content originally appeared on DEV Community and was authored by Shuichi
Shuichi | Sciencx (2021-09-06T01:52:33+00:00) How long is your Maximum Line Length for PEP 8?. Retrieved from https://www.scien.cx/2021/09/06/how-long-is-your-maximum-line-length-for-pep-8/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.