The pass
statement does nothing.
Wow, that's a bummer!
Hmmm...
Then, why do we need it?
Well, it can be used when a statement is required syntactically but the program requires no action.
Let's see an example:
This is also commonly used for creating empty classes so that we can come back later and code something:
Another place pass
statement can be used is inside a function:
Note:
- The body of any statement containing
pass
statements are ignored by the python interpreter, just like it ignores comments.
Top comments (0)