Open clo-vis opened 1 year ago
Flipping not <
to >=
is valid just when the relation is a total order -- when for any two distinct values a
and b
, either a < b
or b > a
. This is true for the <
relation over int
, and also over list
(where <
denotes lexicographic ordering).
But for sets, <
denotes the subset relation, which is a partial order. So {1} < {2}
and {1} > {2}
are both false.
The warning should only trigger when the relation can be confirmed to be a total order (int
, list
, etc).
Looks like the check does work correctly for sets, but not for dict_keys
, which are not sets but are set-like.
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
No error message, as for sets (not A < B) is not the same as (B >= A).
Pylint version
OS / Environment
No response
Additional dependencies
No response