Python pass

SrikartikMateti's avatar
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.

  • 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

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 Pass or PASS will result in a SyntaxError.

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 implemented
print(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:

Code
Output
Loading...

All contributors

Contribute to 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