Re:Python coding standards
by etfb on Monday September 16, 2013 @09:25AM
(#6393089)
Some of the stuff in PEP8 is pretty subjective. What's the state of play for fixing that with an automated tool? Does is spit out advisories, or has some effort been put into the Small Matter Of Programming of interpreting the intent of code? I presume nothing can be done about
Re:Python coding standards
by wffurr on Monday September 16, 2013 @09:35AM
(#6393136)
* Reading a side-by-side diff
* Split-screen editor with multiple columns
* Editor side-by-side with documentation
Long lines are also bad for readability – too much happening in a single line. If you have a very long line, either your names are too verbose, you need to break up your logic into easier to follow steps, or you need to write a function definition and give the logic a name.
79 character lines are arbitrary, but a short line length limit follows directly from the Zen of Python.
Re:Python coding standards
by richardjs on Monday September 16, 2013 @09:36AM
(#6393147)
PEP 8 goes on to give the rational: "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."
It also says that if your team can agree on a longer length, it's okay to increase it.
Re:Python coding standards
by dbaupp on Monday September 16, 2013 @09:33AM
(#6393127)
No, but you might be someone who has two windows of code open at once, or code & a spec sheet (or algorithm description, or help/man page) open side-by-side.
(That said, I prefer 100 columns: two 100 column files fit perfectly next to each other on my screen.)
Re:Python coding standards
by raverbashing on Monday September 16, 2013 @09:36AM
(#6393140)
I can vouch for Pylint, it's very good at finding errors in your code.
Now, all tools have some "pedantic" error reporting, like "function is too complex", thanks, who decided function complexity is me, not some arbitrary determination that functions longer than N lines are "too complex"
which is the up-to-date python style checker built on top of pep8 and pyflakes.
--max-line-lenght=120 --ignore=E128
Long lines are also bad for readability – too much happening in a single line. If you have a very long line, either your names are too verbose, you need to break up your logic into easier to follow steps, or you need to write a function definition and give the logic a name.
79 character lines are arbitrary, but a short line length limit follows directly from the Zen of Python.
It also says that if your team can agree on a longer length, it's okay to increase it.
(That said, I prefer 100 columns: two 100 column files fit perfectly next to each other on my screen.)
Now, all tools have some "pedantic" error reporting, like "function is too complex", thanks, who decided function complexity is me, not some arbitrary determination that functions longer than N lines are "too complex"