Open bouweandela opened 2 months ago
I personally change this always to something like 120, so it may have been me who did this. I'm fine with changing the default, though.
Personally I am a fan of a slightly longer line length, following the reasoning laid out here.
Especially with code for scientific purposes, slightly longer/more explicit function or variable names can make things more readable, and a longer line length makes it a bit easier to have longer names.
Even without nested loops, a single level loop in a class method starts 12 characters in already.
The exact PEP8 line length of 79 is just a legacy from IBM punch cards.
I'd be in favor of lines longer than 79 characters too.
The linked PEP8 section explicitly mentions 99 as a viable option:
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 point of this issue was that we recommend following the conventions in PEP-8 in the guide and that the template should reflect that, not to start a discussion on what the best line length is. Apparently, that is so controversial that even black
does not dare to take a decision on it. Of course, everyone is free to change it to their own liking in their own projects, but the template should use the default.
Maybe make it a question when setting up the cookiecutter and default it to the 79?
For some reason, the generated package has a default line length of 120 characters instead of the 79 prescribed by PEP-8: https://peps.python.org/pep-0008/#maximum-line-length
Since we recommend following PEP-8 in the guide we should do the same thing here.
Having a limited line length also encourages people to avoid code with a high complexity (e.g. deeply nested for loops and if statements) since it just doesn't fit on the line.