You don't need to use 4 spaces on your second conditional line.
(您不需要在第二条条件行上使用4个空格。)
Maybe use: (可能使用:)
if (cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'):
do_something
Also, don't forget the whitespace is more flexible than you might think:
(另外,不要忘记空白比您想象的更灵活:)
if (
cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'
):
do_something
if (cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'):
do_something
Both of those are fairly ugly though.
(两者都相当丑陋。)
Maybe lose the brackets (the Style Guide discourages this though)?
(也许丢了括号(尽管《 风格指南》不鼓励这样做)?)
if cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4':
do_something
This at least gives you some differentiation.
(这至少使您与众不同。)
Or even:
(甚至:)
if cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and
cond4 == 'val4':
do_something
I think I prefer:
(我想我更喜欢:)
if cond1 == 'val1' and
cond2 == 'val2' and
cond3 == 'val3' and
cond4 == 'val4':
do_something
Here's the Style Guide , which (since 2010) recommends using brackets.
(这是《 样式指南》 ,(自2010年起)建议使用括号。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…