Use Python’s pass statement when a block of code must contain a statement but you intentionally want it to do nothing. Despite the common wording in this topic, pass is not a function: you do not call it with parentheses or expect it to return a value. Python’s Language Reference defines it as a null operation—when executed, nothing happens.
What pass does
Python syntax requires a body after headers such as def, class, and if. If you want one of those bodies to be empty for now—or deliberately have no action there—write pass as its indented statement. The Python Language Reference describes pass as a null operation.
How to use pass
Place it on its own indented line wherever Python requires a statement and no action is intended:
def not_implemented_yet():
pass
class Marker:
pass
if condition:
pass
else:
handle_case()
The function and class bodies above are intentionally empty. In the conditional, Python does nothing when condition is true and calls handle_case() when it is false. A function with no explicit return statement returns None when called; that is ordinary function behavior, not a special result produced by pass.
Recommended Free Tools
#1 Best Overall
When it is useful
- As a temporary placeholder: Put
passin a function or branch whose intended behavior you have not implemented yet, so the surrounding code remains syntactically valid. Replace it with the intended statements when ready. - For a deliberately empty body: Use it when an empty function, class, or conditional branch is intentional. If you do not want an empty body, write the action the program should take instead.
pass is not a loop-control statement
pass does not skip to the next loop iteration or exit a loop; it simply does nothing at the point where it appears. Use continue when you want to move to the next iteration, and break when you want to leave the loop.
The Python tutorial also gives while True: pass as an example of a loop that can be interrupted with Ctrl+C. Since the loop contains no waiting operation or useful work, it continuously repeats; it is an illustration of the statement, not a useful general-purpose waiting pattern.
Rank #2
pass and ... are different
The ellipsis literal ... is an expression, while pass is a statement. Python’s tutorial notes that using ... as a placeholder body is a convention, not a special placeholder meaning built into the language. Use pass when you want the explicit no-op statement; do not assume the two constructs have identical roles.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




