目前推荐的用“and”和“or”运算符打破一长串if语句的推荐方法是什么?
第一个选项
使用下面的样式(来自 PEP8)和 flake8 我收到警告:二元运算符后的 W504 换行符:
if (this_is_one_thing and
that_is_another_thing):
do_something()
Run Code Online (Sandbox Code Playgroud)
第二个选项
if (this_is_one_thing
and that_is_another_thing):
do_something()
Run Code Online (Sandbox Code Playgroud)
现在我在二元运算符之前收到警告 W503 换行符。第二个似乎符合PEP8 的这个建议
我试图找到答案,但我仍然不确定。我认为也许使用第二个选项并禁用 W503 警告将是处理此问题的一种方法?