Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

pass statement in Python

📅 2012-May-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ pass, python, statement ⬩ 📚 Archive

I must admit that Python is the first non-assembly language where I have come across a statement like pass. This statement does nothing, quite similar to the nop statement used in assembly languages. It is used in places where the syntax of Python requires a statement, but your program has no real work to do there.

a = ( i for i in range( x ) )
try:
    next( a )
except StopIteration:
    pass

Tried with: Python 3.2