.. _consider-using-in:

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.*

**Problematic code:**

.. literalinclude:: /data/messages/c/consider-using-in/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/c/consider-using-in/good.py
   :language: python



Created by the `refactoring <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/refactoring/refactoring_checker.py>`__ checker.