Python pass
Published Oct 22, 2025
Contribute to Docs
The pass keyword in Python acts as a placeholder in code blocks (like functions or loops) where no action is required. It prevents syntax errors when a statement is needed but no operation should occur.
Syntax
def function_name():
pass
The pass statement is written in lowercase and is often used inside a function, class, loop, or conditional block.
Note: Using incorrect casing like
PassorPASSwill result in aSyntaxError.
Example
In this example, the sum() function is defined but its logic is not yet implemented:
def sum(a, b):pass # actual logic is yet to be implementedprint(sum(5,6))
When called, this function returns None because no return statement is defined.
Codebyte Example
In real projects, developers use pass as a temporary placeholder in unfinished functions to keep the program running without errors:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
- With Certificate
- Beginner Friendly.24 hours