Skip to content

Remove Pass From Elif

Documentation Index

Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt

Use this file to discover all available pages before exploring further.

Removes a pass from the elif section of a conditional

if a:
x()
elif b:
pass
else:
return c
if a:
x()
elif not b:
return c

Reducing the number of branches in a conditional reduces the mental load of reading and understanding it considerably. This simplification can be made where an empty elif branch is immediately followed by the else.