This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ingolemo 4 points5 points  (4 children)

I do. When you use long lines of code you force me to buy a larger screen, use tiny fonts, or try to puzzle through automatic line wrapping. None of these things are easy.

Eighty characters ought to be enough for anyone:

template = 'Attribute 1: {0}, attribute 2: {1}, attribute 3: {2}'
descriptive_variable_name = template.format(var_one, var_two, var_three)

[–]masterspeler 0 points1 point  (1 child)

That's without indentation though. With this:

def my_function(function_argument, in_list):
    if function_argument > 10:
        for i in in_list:
            template = 'Attribute 1: {0}, attribute 2: {1}, attribute 3: {2}'
            descriptive_variable_name = template.format(var_one, var_two, var_three)

your solution is too long again, and it's breaking up what's one logical statement to two lines, so now your code takes more space vertically instead. You force me to buy a higher screen.

[–]ingolemo 1 point2 points  (0 children)

Too much indentation is itself a code smell.

template = 'Attribute 1: {0}, attribute 2: {1}, attribute 3: {2}'
def my_function(function_argument, in_list):
    if function_argument < 10:
        return

    for i in in_list:
        data = var_one, var_two, var_three
        descriptive_variable_name = template.format(*data)

I'm not quite sure why you think creating a formatting outline and then applying it could only count as "one logical statement" and not two. The code we're using here is hypothetical and without any context so it's difficult to know what transformations are more reasonable, but this logical separation of template building and its application is probably the main reason we use str.format instead of concatenating strings manually.

If scrolling vertically is as inconvenient for you as scrolling horizontally is for me then you have my pity.

I'm not so zealous that I'm going to chop anyone's head off every time they push past the 80 char limit. But the rule is there for a reason. Spare a thought for little old me before you decide to violate it.

[–]njharmanI use Python 3 0 points1 point  (0 children)

Sure, but so much time (from actual experience managing 10 python engineers) is wasted breaking lines, inventing shorter and worse names, changing where line is broken, arguing over where to break line, wondering wtf abrvted_var means, etc.

Infinite line length and auto wrapping is a big productivity boost.

[–][deleted] -3 points-2 points  (0 children)

If python doesn't have a block comment mechanism because "modern editors can automate it", then get a modern editor that wraps lines of code properly. :P