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

Jan Kanis jan.kanis at phil.uu.nl
Fri May 22 15:32:42 CEST 2009


There is, of course, a correct solution to this line length problem.
The ideal maximum line length is dependent on how much horizontal
space you've got, so the code should be automatically wrapped to your
window size. That's how all other text displaying systems work, from
html to word processors. It's just code that's the exception*.

This would require good automatic wrapping, which is a bit more
difficult for code than for English, but automatic reformatting
utilities already exist. It would also require tool support, so
everyone would need to use editors like emacs or something else that's
programmable. Just your favorite notepad-on-steroids variant won't
suffice anymore.

Of course, it's only 2009 and this is all very much py-in-the-sky.
(Though who knows what Python 6000 will bring...)

* another exception are config files, but more and more people are
writing gui config editors, which adapt to the window size, so these
too are following the trend.


The only backward compatible way I can think of to implement this is
to tell your emacs or other programmable editor to automatically
display files according to your window width, and wrap them to
80/whatever cpl in the on disk representation when you save. And add
some magic so it only changes those parts of the file in the on disk
representation that you actually edited, deal smartly with line
numbering, etc, etc.


Jan



More information about the Python-ideas mailing list