我记得有这是做什么或后填补空白相当于一个虚拟的声明if,elif,else,和for语句,以保持期望的压痕.
以下示例不起作用
if True:
#I want to simply pass this branch
# ... NOP command here
else:
print "False"
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
有pass:
def foo():
pass
Run Code Online (Sandbox Code Playgroud)
在Python 3中还有省略号...*,它本身并不是真的意思,但有时也会使用:
def foo():
...
Run Code Online (Sandbox Code Playgroud)
在语义上,我希望看到...你那部分没有写入尚未作为存根,并且pass当有永远不会有结果的代码存在.
*省略号也存在于Python 2中,但不能在方括号外使用foobar[...].