Square Identity¶
Sourcery refactoring id: square-identity
¶
Description:¶
Replaces cases of a variable being multiplied by itself with squaring that variable
Before:¶
def square(variable: int):
return variable * variable
After:¶
def square(variable: int):
return variable**2
Explanation:¶
This identity can make the code slightly shorter and easier to read.