consider-swap-variables / R1712ΒΆ

Message emitted:

Consider using tuple unpacking for swapping variables

Description:

You do not have to use a temporary variable in order to swap variables. Using "tuple unpacking" to directly swap variables makes the intention more clear.

Problematic code:

a = 1
b = 2

temp = a  # [consider-swap-variables]
a = b
b = temp

Correct code:

a = 1
b = 2

a, b = b, a

Created by the refactoring checker.