PEP8 compliance and exception messages ?

shearichard shearichard at gmail.com
Tue Dec 7 05:53:44 EST 2010


On Dec 7, 9:17 am, Andreas Waldenburger <use... at geekmail.INVALID>
wrote:
> On Mon, 6 Dec 2010 00:22:49 -0500 Andreas Waldenburger <use... at geekmail.INVALID> wrote:
>
>
>
> > On Sun, 5 Dec 2010 19:52:54 -0800 Chris Rebert <c... at rebertia.com>
> > wrote:
>
> > > On Sun, Dec 5, 2010 at 7:40 PM, shearichard <shearich... 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.

Thanks to everyone for their helpful replies.

Thanks for the pointers towards implicit (or explicit) string
concatenation - just what was needed.

I appreciate everyone has different opinions by I'm happy to try to
stick with 79 character lines for the meantime - largely for the 'may
have a wide screen but like to have lots of files open in slim
windows' reason.

regards

Richard.




More information about the Python-list mailing list