PEP8 compliance and exception messages ?

Andreas Waldenburger usenot at geekmail.INVALID
Mon Dec 6 15:17:21 EST 2010


On Mon, 6 Dec 2010 00:22:49 -0500 Andreas Waldenburger <usenot at geekmail.INVALID> wrote:

> On Sun, 5 Dec 2010 19:52:54 -0800 Chris Rebert <clp2 at rebertia.com>
> wrote:
> 
> > On Sun, Dec 5, 2010 at 7:40 PM, shearichard <shearichard at gmail.com>
> > wrote:
> > > Hi - PEP8 says lines should not exceed 79 characters in length
> > > ( http://www.python.org/dev/peps/pep-0008/ ).
> > >
> > > So if you've got some code that looks like this :
> > >
> > > raise fooMod.fooException("Some message which is quite long")
> > >
> > > ... and assuming a certain amount of indenting you're going to
> > > break that guideline.
> > >
> > > [etc.]
> > 
> > [...]
> > Alternatively, you could disregard PEP 8 on this point on the
> > grounds that the 79/80 characters per line limit is outdated.
> > 
> Maybe, but it's not outmoded.
> 
As a more useful (I hope) reply, my opinion in this case is to just make the line a little longer. Even if you can't read it all at once, it is pretty obvious what comes next: The rest of the error message. There is no additional functionality hidden there, and you don't need to see it all at once to grasp the meaning of the code.

/W


-- 
To reach me via email, replace INVALID with the country code of my home 
country.  But if you spam me, I'll be one sour Kraut.




More information about the Python-list mailing list