-
-
Notifications
You must be signed in to change notification settings - Fork 3k
False negative when using magic methods #8027
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
Comments
This is a duplicate of #7339 |
@ilevkivskyi doesn't #7339 cover a false positive? This here is a false negative 🤔 Or is that issue supposed to cover everything-indexing? Type refinement can't be safely accomplished in the sample code, therefore mypy should reject it. |
OK, I see. Then this is a duplicate of a different issue #4168 (modulo attribute -> index). The latter has also false-positive label because overly narrow types cause troubles with |
Thanks for the info! |
Uh oh!
There was an error while loading. Please reload this page.
Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues
Please provide more information to help us understand the issue:
Bug?
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
The one below doesn't type check, as expected:
It should not type check, as repeated calls to
__getitem__
are not guaranteed to return the same value.Do you see the same issue after installing mypy from Git master?
--strict --scripts-are-modules
The text was updated successfully, but these errors were encountered: