Skip to content

Remove Pass From Body

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 body of a conditional by inverting it

if not a:
pass
else:
return c
if a:
return c

It is much clearer for a conditional to do something in its main body than solely in its else clause. In the latter case anyone reading the code has to mentally invert the condition in order to determine the meaning.