Skip to main content
Albero Academy

pass

A do-nothing placeholder for code you have not written yet.

Flow Control5 min

Python requires a statement wherever a block is expected — after a def, if, class and so on. An empty block is a syntax error. pass is a do-nothing statement that satisfies that requirement, letting you stub out code you haven't written yet.

Stubbing out code

placeholders while you build
def process_payment():
pass # TODO: implement later — no syntax error meanwhile
class Order:
pass # an empty class you'll flesh out
if condition:
pass # decide to do nothing here for now
else:
handle()

pass vs continue vs ...

Key takeaways

  1. 01pass is a no-op that satisfies Python's requirement for a non-empty block.
  2. 02Use it to stub functions, classes and branches you'll implement later.
  3. 03Inside loops, prefer continue when you mean "skip this item".
  4. 04Ellipsis (...) is sometimes used as an equivalent placeholder.

Finished this chapter?

Mark it complete to track your progress through Python.