What is the recommended way to break a long if statement? (W504 line break after binary operator)

If we consult the documentation on flake 8 we see: Anti-pattern Note: Despite being in the anti-pattern section, this will soon be considered the best practice. income = (gross_wages + taxable_interest) Best practice Note: Despite being in the best practice section, this will soon be considered an anti-pattern. income = (gross_wages + taxable_interest) So the … Read more

Line continuation for list comprehensions or generator expressions in python

[x for x in (1,2,3) ] works fine, so you can pretty much do as you please. I’d personally prefer [something_that_is_pretty_long for something_that_is_pretty_long in somethings_that_are_pretty_long] The reason why \ isn’t appreciated very much is that it appears at the end of a line, where it either doesn’t stand out or needs extra padding, which has … Read more