2006-01-19

Python | limiting lines to 80 chars ? Are you crazy ? Is this COBOL or what ?

A Python Style Question : according to PEP-8 http://www.python.org/peps/pep-0008.html lines should have a max of 79 characters because "There are still many devices around that are limited to 80 character lines". My question is this, should i try and force myself to write code in this style?

Answers :

1.
Follow it wherever possible, a better reason to follow that is that longer lines are harder to read.
2.
I don't count mine at all, however I try to keep them short enough to read easily
3.
That style guide is for code in the mainline python, that document doesn't suggest that *your* code should follow that guide
4.
I do work on 80 char terminals at times and yeah, it's very annoying when lines wrap but even if I'm in X, I find long lines difficult to read. Also, short lines make interactive debugging easier.

Fundamentally, writing readable code is more about common sense than following style guides, they cannot account for every contingency, and, like all things, are imperfect.

0 Comments:

Post a Comment

<< Home