The use of Pass statement is to do nothing. It is just a placeholder for a statement that is required for syntax purpose. It does not execute any code or command.
Some of the use cases for pass statement are as follows:
- Syntax purpose:
>>> while True:
… pass # Wait till user input is received
- Minimal Class: It can be used for creating minimal classes:
>>> class MyMinimalClass:
- Place-holder for TODO work:
We can also use it as a placeholder for TODO work on a function or code that needs to be implemented at a later point of time.
>>> def initialization():
… pass # TODO