English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
In this article, you will learn about the pass statement. It is used as a placeholder for implementing functions, loops, and so on later.
In Python programming, the pass statement is an empty statement. In Python,CommentsThe difference between and pass statement is that, although the interpreter completely ignores comments, pass is not ignored.
However, there is no response when passing execution. The result is no operation (NOP).
pass
We usually use it as a placeholder.
Suppose we have an unimplementedLooporfunctionBut we want to implement it in the future. They cannot have an empty body, the interpreter will give an error. Therefore, we use the pass statement to construct a body that does not perform any operation.
'''pass is just a placeholder, for adding features in the future. ''' sequence = {'p', 'a', 's', 's'} for val in sequence: pass
We can also use it in an emptyfunctionorIn the classPerform the same operation.
def function(args): pass
class Example: pass