What is currently the recommended way to break a long line of if statement with "and" and "or" operators?
1st option
With the style below (which is from PEP8) with flake8 I'm getting warnings: W504 line break after binary operator:
if (this_is_one_thing and
that_is_another_thing):
do_something()
2nd option
if (this_is_one_thing
and that_is_another_thing):
do_something()
Now I'm getting the warning W503 line break before the binary operator.
The second seems to be in line with this recommendation from PEP8
I tried to find an answer but I'm still unsure. I think maybe using 2nd option and disabling the W503 warning will be a way to deal with this problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…