Remove Pass From Body¶
Sourcery refactoring id: remove-pass-body
¶
Description:¶
Removes a pass
from the body of a conditional by inverting it
Before:¶
if not a:
pass
else:
return c
After:¶
if a:
return c
Explanation:¶
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.