Remove Redundant Pass
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.
Sourcery refactoring id: remove-redundant-pass
Section titled “Sourcery refactoring id: remove-redundant-pass”Description:
Section titled “Description:”Removes unnecessary pass statements
Before:
Section titled “Before:”if a: x()else: passdo_something()passAfter:
Section titled “After:”if a: x()do_something()Explanation:
Section titled “Explanation:”A pass statement is unnecessary if a block has other statements in it, and an
else which only contains pass can be safely removed. Making these changes
shortens the code, and the reader doesn’t have to consider and deal with the
unnecessary pass statements.