Assume that you have this class:
class ThisIsAClass
pass
What´s the pass argument?, What does it do?. Im very confused about this..
Assume that you have this class:
class ThisIsAClass
pass
What´s the pass argument?, What does it do?. Im very confused about this..
pass
does nothing.
It's used in cases where syntax demands a statement, but you don't want to do anything else. In this case, you are creating a class (assuming you add the missing :
) that has no attributes and no functionality. If you had omitted pass
you would get a SyntaxError
, because colons must be followed by a valid statement on the appropriate indentation level.
It's simply used when a statement is required, but you don't want any code actually executed. A common place in the Except portion of a try, except block.