Skip to content

Binary operator identity

Sourcery refactoring id: bin-op-identity

Description:

Replaces binary operationss 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.

Back to top