Hi, thanks a lot for this flake8 library, It's been helping us a lot with keeping a nice code quality 1
I think we've spotted a small issue when it comes to replacing not < with >= rules using sets.
Desired change
- Rule(s): SIM204, SIM205, SIM206, SIM207
- Adjustment:
Using sets, saying not (a < b) is not equivalent to a >= b:
not (a < b): there is no element of a that is in b
a >= b: all elements of b are in a
I am unsure what the adjustment should be, maybe omit these rules when comparing sets ?
Explanation
On sets, (not (a < b)) != (b >= a)
Example
This is an example where the mentioned rule(s) would currently be suboptimal:
a = {4, 5}
b = {1, 2, 3}
# this raises: SIM204 Use 'a >= b' instead of 'not (a < b)'
assert not (a < b) # no elements of a are in b; would pass
# when making the suggesting change:
assert a >= b # all elements of b are in a -> AssertionError
Hi, thanks a lot for this flake8 library, It's been helping us a lot with keeping a nice code quality 1
I think we've spotted a small issue when it comes to replacing
not <with>=rules using sets.Desired change
Using sets, saying
not (a < b)is not equivalent toa >= b:not (a < b): there is no element of a that is in ba >= b: all elements of b are in aI am unsure what the adjustment should be, maybe omit these rules when comparing sets ?
Explanation
On sets,
(not (a < b)) != (b >= a)Example
This is an example where the mentioned rule(s) would currently be suboptimal: