On Thu, May 21, 2009 at 9:04 AM, Lie Ryan <lie.1296@gmail.com> wrote:
Raymond Hettinger wrote:

Some people find their productivity is enhanced with an 80 character limit.

Perhaps this is true, though I've not heard one jot of evidence to support it
and certainly no evidence focusing on Python coding practices which are
affected by the use of whitespace for control flow.  Nor have I seen evidence
of comparative productivity of 80 char limits versus 100 char limits.  All we
have is anecdotal evidence and personal tastes.

This is how I will write program if we have 160 character limit:

def foo(f, a, b, c):
   return [[((f(x, y) * i, i) if i % 2 else 0) for i, x in enumerate(a) if f(y, x) == a + x] for y in [c(z) for z in range(a, a * b + c, c)]]

except there will be no line breaks...

I love list comprehension so much that I often _unconsciously_ write a very complex list comprehensions. 80-character convention acts as a reminder to consider refactoring.

hmm, the 80-character convention does not stop me from unconsciously writing really complex list comprehensions, I just write them like so:

def foo(f, a, b, c):
    return [[((f(x,y) * i, i) if i % 2 else 0)
                for i, x in enumerate(a)
                if f(y, x) == a + x]
              for y in [c(z) for z in range(a, a*b+c, c)]]

not that that's really any better.

I really don't mind the 80-character convention. I occasionally have problems with going over it, but most of the time it serves (as you point out) as a flag for something that probably needs refactoring. When I do go over it, it's normally only by a few chars.

The other benefits of it, for me, is easily reading code in a terminal in the few cases I end up without X , and for opening multiple files in emacs with vertical-split. The latter is a huge benefit, and could still be done if the convention was upped to, say, 100 chars - but would start to get annoying with wrapping shortly after that.

But yeah, this is all anectodal evidence and personal taste, as Raymond points out. The 80 char limit _had_ a practical reason for existing, and I don't doubt that there are people out there that are still using the (hard|soft)ware that caused the limit to be practical, but they're probably few and far between. I also haven't seen anything other than anectodal evidence and personal taste in favor of increasing the limit, which suggests to me that it should just stay how it is. It is just a convention after all.