Pattern: Unnecessary pass
statement
Issue: -
A pass
statement is only necessary when it is the only statement in a block. If the block already contains other statements then the pass
statement is unnecessary and can be removed.
Example of incorrect code:
try:
A = 1
except ValueError:
A = 2
pass # [unnecessary-pass]
Example of correct code:
try:
A = 1
except ValueError:
pass