PEP8 79 char max

Neil Cerutti neilc at norwich.edu
Tue Jul 30 10:49:06 EDT 2013


On 2013-07-30, Skip Montanaro <skip at pobox.com> wrote:
>> In that gauge I would exclude indentation (you don't count the
>> number of characters the margin takes) ....
>
> I don't think anyone reads the margins. :-)
>
> That said, I agree that code and prose are fundamentally
> different beasts.  Still, when reading either and you get to
> the end of the line, you need to shift your gaze down a line
> and back to the left margin (or the left margin plus any
> indentation).  That task becomes more difficult as line length
> increases.

Most research about speed of comprehension of different line
lengths was based on subjects reading prose. The effect of code
line length hasn't been studied extensively.

> As programmers/software engineers, we need to read and write
> both code and text. I think 80 columns is still a decent
> compromise.

So rules of thumb, standardizations, and personal preferences are
mostly what we have to go by.

When code that looks very similar to code you've seen before
really *is* similar to code you've seen before, comprehension
speed can increase. A study of chess masters' ability to memorize
chess positions showed that they were powerfully accurate when
shown positions from real games, but no better than the average
schmoe when shown randomly positioned pieces. So if everyone
basically follows PEP8 we all benefit from playing by the same
game rules, as it were.

-- 
Neil Cerutti



More information about the Python-list mailing list