[Python-ideas] 80 character line width vs. something wider

Georg Brandl g.brandl at gmx.net
Fri May 22 21:20:53 CEST 2009


Jim Jewett schrieb:

> I have seen (but can't find at the moment) studies showing that lines
> wider than a certain percentage of the visual field are problematic.
> The exact portion (and how many characters fit in it at a readable
> font) will vary from person to person; what is comfortable for you may
> already be very disruptive for a teammate -- and your savings from a
> longer line are small enough that this is one case where lowest common
> denominator should be given great weight.  (Leading whitespace is much
> "cheaper" than actual text, but there is still some effort in sliding
> that focal window back and forth with the indent/dedent dance.)
> 
> And of course, this concern with visual focal area already assumes
> that everyone will have windows as wide as yours and fonts as small; I
> can assure you that neither is true.  The first person to need
> horizontal scrolling will lose more time than you saved.  The first
> person using a window/terminal where the line wrapped on its own
> because it was too long will squander far more.

I agree completely.

I also find, and that is of course a subjective finding, that my "on-sight"
estimation of code quality partly depends on line length.  Code that looks
"frayed" (forgive me if that's not the right word) immediately looks less
"tidy" to me.  Of course, other factors come into play, like the amount of
whitespace applied, the consistency of indentation, the consistency and
spelling in comments etc.  These are all stylistic points, but in summa, the
code itself more often than not turns out to confirm the first look assessment.

This means that most decent Python programmers know PEP 8 and follow it.  The
reasons may be as simple as mindlessly following the established standard,
but I suspect otherwise: if PEP 8 was completely unreasonable, a different
standard would have emerged.

2¢-ly,
Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.





More information about the Python-ideas mailing list