Capurnicus Capurnicus - 1 year ago 34
Python Question

How To Use The Pass Statement In Python

I am in the process of learning Python and I have reached the section about the

statement. The guide I'm using defines it as being a
statement that is commonly used as a placeholder.

I still don't fully understand what that means though. Can someone show me a simple/basic situation where the
statement would be used and why it is needed?


Suppose you are designing a new class with some methods that you don't want to implement, yet.

class MyClass(object):
    def meth_a(self):

    def meth_b(self):
        print "I'm meth_b"

If you would leave out the pass, the code wouldn't run.

You would then get an

IndentationError: expected an indented block

To summarize, the pass statement does nothing particular but can act as a placeholder, as shown before.