Python pass is a statement in python which is used as a placeholder for implementations inside functions, loops, etc.
Python pass statement allow to bypass the syntactical requirement i.e the code blocks such as
class, etc cannot be empty.
Suppose you are designing a class with some methods you don’t want to implement yet. what will you do? Since you cannot leave the method empty.
In this case
pass is used to not to produce any error.
class Dog: def eat(): pass def walk(): print("Dog can walk")
Similarly, it can be used inside an empty loop for which you have not decided any implementation yet.
def doSomething(): for x in range(10): pass
What is the difference between comment and pass?
pass is similar to null statement. Comment in python is ignored by the compiler but pass gets executed by the compiler. This is the major difference between comment and pass in python.
Comment below your doubts or suggestion.