[Python-Dev] pep8 reasoning

Chris Angelico rosuav at gmail.com
Fri Apr 25 04:00:17 CEST 2014


On Fri, Apr 25, 2014 at 11:40 AM, Allen Li <cyberdupo56 at gmail.com> wrote:
> 2) If you're starting a new project, follow PEP8 (or the standards for
>    the language you're using) to preserve CONSISTENCY.

Don't forget that PEP 8 is not the standard for the Python language,
only the Python stdlib. Particularly, there's no strong reason to
follow some of its lesser advices (eg spaces rather than tabs, the
exact maximum line length) for new projects; if all your developers
have good quality screens, there's no point wrapping all your code to
79 just because the Python standard library is wrapped to 79. That
particular example is touched on in the PEP itself (suggesting 20 more
characters); you could easily set a maximum of 89, 99, or 159
characters if it makes sense for your project. Consistency with the
standard library in names is slightly more useful, but the standard
library isn't perfectly consistent itself (eg not all class names
start with a capital), and if you're spending too much time arguing
about style instead of getting code written, your style guide isn't
doing its job :)

ChrisA


More information about the Python-Dev mailing list