[原文]
4.5. pass Statements
The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action. For example:
>>> while True:
... pass # Busy-wait for keyboard interrupt (Ctrl+C)
...
This is commonly used for creating minimal classes:
>>> class MyEmptyClass:
... pass
...
Another place pass can be used is as a place-holder for a function or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. The pass is silently ignored:
>>> def initlog(*args):
... pass # Remember to implement this!
...
【译】
4.5. pass 语句
pass语句表示什么都不做直接执行它后面的语句。它被使用是因为语法上必须有一个语句用于程序什么都不做的时候。例如:
更常见的应用是建立小的类:
Pass的另一个应用是作为占位符。当你编写新代码时,函数或条件还没有确定,允许你更高层次的思考,pass就出现在这样的地方,表示在这个地方暂时不需要做什么。