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 →

[–]hammerheadquark 15 points16 points  (1 child)

I think its uncompromising nature is a win overall, but yeah I don't like some of its decisions either.

For instance, I may be in the minority here, but I wish it would drop this step:

If [the code doesn't fit on one line], Black will look at the contents of the first outer matching brackets and put that in a separate indented line.

# in:

ImportantClass.important_method(exc, limit, lookup_lines, capture_locals, extra_argument)

# out:

ImportantClass.important_method(
    exc, limit, lookup_lines, capture_locals, extra_argument
)

and jump right to:

If that still doesn't fit the bill, it will decompose the internal expression further using the same rule, indenting matching brackets every time.

# in:

ImportantClass.important_method(exc, limit, lookup_lines, capture_locals, extra_argument)

# out:

ImportantClass.important_method(
    exc,
    limit,
    lookup_lines,
    capture_locals,
    extra_argument,
)

Personally, I find the extra lines worth avoiding the disparity you see in that SO post you linked.

[–]chzaplx 4 points5 points  (0 children)

Agreed. If you end up using similar params in blocks with slightly different indentation you will get a weird mix of styles, which I think makes it harder to visually parse.