Skip to content

Binary Operator Identity

Sourcery refactoring id: bin-op-identity

Description:

Replaces binary operations between a value and itself with known identities:

Changes:

  • x | x => x
  • x & x => x
  • x ^ x => 0
  • x - x => 0
  • x / x => 1
  • x // x => 1
  • x % x => 0

Explanation:

These changes simplify the code, making it easier to understand what is going on.