-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
incorrect scenario of unidiomatic-typecheck #10161
Comments
thank you for highlighting this case. currently, no message is raised when the
and imo this seems like an inconsistency as both cases ( |
I like the idea of encouraging |
Hi, I'd like to work on fixing this issue. Could you confirm whether the behavior described in the table below reflects the expected behavior? (Perhaps add a new message suggesting the use of 'is' instead of '==').
|
Thanks for expressing interest, @nedelcu-ioan. A bit of context about this issue, OP is referring to a "strict" type comparison here. In most cases, we want to use the idiomatic way But there may be specific cases where we want to perform a "strict" comparison to check if both types are strictly equal, that's when That's why we should maintain current behavior for all cases except for
|
Agree with @zenlyj's analysis. Sorry if my tangent was distracting. I'd be interested to explore expanding |
Bug description
I think that pylint should detect the case when
type()
is used to compare two types, in which case IMHOisisntance()
should not be used:Configuration
Command used
Pylint output
Expected behavior
No error triggered.
Pylint version
OS / Environment
No response
Additional dependencies
The text was updated successfully, but these errors were encountered: