79 chars or more?

Michael Torrie torriem at gmail.com
Tue Aug 17 01:20:51 EDT 2010


On 08/16/2010 10:50 PM, AK wrote:
> I stay away from ugly cramped one-liners; I mostly run over 79 when I
> have a few `and` and `or` clauses or long strings. I've also noticed
> something interesting: going from 79 to 99 affects a relatively large
> number of lines, but going over 99 (i.e. 99 to 132) is much, much rarer.

I have found something similar, despite my previous post.  But you can
normally break the and and or long clauses with backslash
line-continuators.  You can also break strings similarly:

a = "This is a really long line that ordinarily would " \
    "be long. Test message: %s " % ( message_string)


> By the way, the reason I asked is that we're working on a python
> tutorial and I realized that even though I'm used to 99, I wasn't sure
> if it's ok to teach that to new users or not..

I wouldn't worry about it if I were you.  Once they know how to program
in Python then you can work on that.  Probably more important to be
taught the reasons behind PEP8.  You could probably say that many coders
recommend that lines not exceed 80 characters, and state that code in
the standard library has to be less than that, but that on occasion
longer lines are probably not going to kill them.



More information about the Python-list mailing list