Simplify Numeric Comparison
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: simplify-numeric-comparison
Section titled “Sourcery refactoring id: simplify-numeric-comparison”Description:
Section titled “Description:”Consolidates any mathematical operations in a numeric comparison so there is a direct comparison of variable to number
Before:
Section titled “Before:”if a + 1 < 2: do_x()After:
Section titled “After:”if a < 1: do_x()Explanation:
Section titled “Explanation:”This refactoring removes unnecessary clutter from the code and makes it easier to determine what a variable is being compared to.