-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pylint should not report literal-comparison when testing for tuple #3031
Comments
Yeah, we can probably exempt tuples from the check. |
chaoflow
changed the title
Pylint should not report literal-comparison when testing for empty tuple
Pylint should not report literal-comparison when testing for tuple
Jul 29, 2019
@PCManticore I think it's noteworthy that only starting with Python 3.7 |
jaehoonhwang
added a commit
to jaehoonhwang/pylint
that referenced
this issue
Oct 11, 2021
Pierre-Sassoulas
added a commit
that referenced
this issue
Oct 17, 2021
…on with collection literals (#5120) * Create a new checker; use-implicit-booleanness checker where it looks for boolean evaluatiion with collection literals such as `()`, `[]`, or `{}` * Fixed invalid usage of comparison within pylint package This closes #4774 * Ignore tuples when checking for `literal-comparison` Closes #3031 * Merge len_checker with empty_literal checker Moving empty literal checker with len_checker to avoid class without iterators without boolean expressions (false positive on pandas) Reference: https://github.com/PyCQA/pylint/pull/3821/files * Update `len_checker` and its class `LenChecker` to `ComparisonChecker` to reflect better usage after merging between `len_checker` and `empty_literal_checker` and its tests. * Fixed `consider_using_in` and `consider_iterating_dictionary` tests that were failing due to new empty literal checkers. Co-authored-by: Pierre Sassoulas <[email protected]>
Following up on this, I think only the empty tuple should be exempted. compare tuple(range(0)) is ()
tuple(range(1)) is (0,) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Current behavior
pylint reports "literal-comparison"
Expected behavior
pylint should regard the "is (not)" comparison correctly.
pylint --version output
The text was updated successfully, but these errors were encountered: