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)]]