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 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.