假设您正在设计一个新类,其中包含一些您还不想实现的方法。
class MyClass(object): def meth_a(self): pass def meth_b(self): print "I'm meth_b"
如果你不考虑 pass ,代码无法运行。
pass
然后你会得到:
IndentationError: expected an indented block
总而言之, 通过 语句没有什么特别的功能,但它可以充当占位符,如这里所示。
通过