Skip to content

Swap nested ifs

Sourcery refactoring id: swap-nested-ifs

Description:

Swaps the order of nested if statements

Before:

if a:
    if b:
        return c

After:

if b:
    if a:
        return c

Explanation:

This refactoring identity will not improve code quality on its own, but can be part of a series of steps that will improve quality. Sourcery will only suggest this refactoring where it unlocks further improvements.

Back to top