-
-
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
False positive for unidiomatic-typecheck #3337
Comments
+1 Steps to reproduce
Current behaviorpylint seemingly assumes the two statements are equivalent in all cases:
The upshot is that following the suggestion and changing the code to the isinstance() variant can change the intended behavior of the code, is which case it is not desired. We do not want our inexperienced developers blinding implementing this change. The docs do capture this and state: However Expected behaviorBecause it is very much worth considering I see no issue is disabling "consider-" type checks, as and when needed. pylint --version output
|
…n`` operators The original use case for this check was to catch old style type checking idioms such as `type(x) is ...`, but it should not have been extended to handle `in` operators as well. Close #3337
Thanks for the report! I agree with @doublethefish as this check should not have handled |
…n`` operators The original use case for this check was to catch old style type checking idioms such as `type(x) is ...`, but it should not have been extended to handle `in` operators as well. Close #3337
Steps to reproduce
Consider following code:
Current behavior
pylint tells that
type(None) in ...
is "unidiomatic typecheck" and should be replaced withisinstance()
Expected behavior
pylint shouldn't show a warning, because while it's not a type check and can't be replaced with
isinstance()
.pylint --version output
The text was updated successfully, but these errors were encountered: