Introduction
To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained in it instead of checking for equality against each of the values. This is faster, less verbose, and more readable.
What to do:
Bad code like
if x == 1 or x == 2 or x == 3: do_something()
should be replaced to
if x in (1, 2, 3): do_something()
- The PYL-R1714 issues are listed here
Important hints
- additional information and code samples can be found here
- refer our Coding Convention Guidlines