Search code examples
conventionspep8

Why do maximum line lengths sometimes end with 9?


In some conventions, PEP-8 for example, I see maximum line widths recommended to be set to values ending with 9, such as 79, 99, 119. Why not rounded to 10, like 80, 100, 120?

I feel like it's an off-by-one error I don't understand.


Solution

  • Allegedly from GvR himself, from an r/learnpython thread:

    One person suggested that 79 character code allows for a + or - for diffs in windows that are limited to 80 characters. While that is certainly true, I wasn't sure that this was the answer, so I e-mailed the authors of the PEP 8 document and got this reply back from Guido van Rossum just over an hour after I sent the e-mail:

    Because an 80 char wide Emacs window starts wrapping at 79.