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

Jim Jewett jimjjewett at gmail.com
Fri May 22 03:44:33 CEST 2009


On 5/19/09, Jason Orendorff <jason.orendorff at gmail.com> wrote:

> On Tue, May 19, 2009 at 1:15 PM, Raymond Hettinger <python at rcn.com> wrote:
> I find the long lines in my code are not as contrived as the thread so
> far suggests:

FWIW, I would find it easier to read all but one of these if they were
broken into multiple lines -- and that is regardless of what monitor I
happened to be using at the time.

>             sys.stderr.write("js-build: WARNING: Due to COMMAND_MODE
> madness, this can fail on Leopard!\n"
>                              "js-build:          Workaround is to
> upgrade to Python 2.5.2 or later.\n")

My idiom here is to take out the literal, at least to its own line.
For example:

            msg="""\
js-build: WARNING: Due to COMMAND_MODE madness, this can fail on Leopard!
js-build:          Workaround is to upgrade to Python 2.5.2 or later.
"""
           sys.stderr.write(msg)

>                             self.parent[id] = self.lastbranch.get(branch,
> 'bad')

This was the only one where a line break might hurt readability for
me, and I still suspect a rewording would make it easier to read.

-jJ



More information about the Python-ideas mailing list