PY3.R1716

Chained comparison

This message is emitted when we encounter boolean operation like a < b and b < c, suggesting instead to refactor it to a < b < c.

Noncompliant Code:

Copy
a = int(input())
b = int(input())
c = int(input())
if a < b and b < c:
    pass

Compliant Code:

Copy
a = int(input())
b = int(input())
c = int(input())
if a < b < c:
    pass

The content on this page is adapted from the Pylint User Guide, Copyright ©2003-2022, Logilab, PyCQA and contributors. All rights reserved. https://pylint.pycqa.org/en/latest/index.html#, and is used under the Python Software Foundation License Version 2. Examples, recipes, and other code in the Pylint documentation are additionally licensed under the Zero Clause BSD License.