consider-using-in / R1714#

Message emitted:

Consider merging these comparisons with 'in' by using '%s %sin (%s)'. Use a set instead if elements are hashable.

Description:

To check if a variable is equal to one of many values, combine the values into a set or tuple and check if the variable is contained "in" it instead of checking for equality against each of the values. This is faster and less verbose.

Correct code:

def fruit_is_round(fruit):
    return fruit in {"apple", "orange", "melon"}

Problematic code:

def fruit_is_round(fruit):
    return fruit == "apple" or fruit == "orange" or fruit == "melon"  # [consider-using-in]

Created by the refactoring checker.