pass statement is a no-operation placeholder.
For instance, you can write an infinite loop that does nothing using
>>>while True: pass ...
pass is to statements as
None is to objects, nothing.
pass is also sometime coded to mean “to be filled in later”.
>>> def myfunct1(): ... pass ... >>> def myfunct2(): ... pass ...
We can’t leave the body empty without getting a syntax error, so we say pass instead.
In Python 3 you can use ellipses coded as
... (three consecutive dots) to appear any place an expression can.
>>> def myfunct(): ... ... ... >>> myfunct()
Of course, when called,
myfunct() does nothing.
Ellipses can also appear on the same line as a statement header and may be used to initialize variable names.
>>> def f1(): ... ... >>> def f2(): ... ... >>> x = ... >>> x Ellipsis