reimplemented-operator (FURB118)#
Derived from the refurb linter.
Fix is sometimes available.
This rule is unstable and in preview. The --preview flag is required for use.
What it does#
Checks for lambda expressions and function definitions that can be replaced
with a function from the operator module.
Why is this bad?#
The operator module provides functions that implement the same functionality
as the corresponding operators. For example, operator.add is equivalent to
lambda x, y: x + y. Using the functions from the operator module is more
concise and communicates the intent of the code more clearly.
Example#
Use instead: