Skip to content

Simplify Numeric Comparison

Sourcery refactoring id: simplify-numeric-comparison

Description:

Consolidates any mathematical operations in a numeric comparison so there is a direct comparison of variable to number

Before:

if a + 1 < 2:
    do_x()

After:

if a < 1:
    do_x()

Explanation:

This refactoring removes unnecessary clutter from the code and makes it easier to determine what a variable is being compared to.