Flip-Comparison¶
Sourcery rule id: flip-comparison
¶
Description¶
Moves variables from the right side to the left side of comparisons
Before¶
1 == a
After¶
a == 1
Explanation¶
It is a coding convention that when doing comparisons to a numeric constant, the number should be on the right and the variable on the left. Having things be consistent in this way makes the code easier to read.