-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
self.x: str = 1000. Why is this not an error? #7857
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
Hi, it looks like |
I feel like it'd be reasonable to change the behavior though. The intent behind mypy's behavior of not type checking unannotated methods is to enable gradual typing: users can gradually add more typing to their codebase, without worrying about type errors in functions that don't have annotations yet. But clearly if the user put a variable annotation in the function, they did intend to apply typing to the function and would expect mypy to typecheck it. |
Yeah, I think this is a reasonable idea. |
This is then essentially a duplicate of #3948 |
The question is basically in the header.
Why is this an error:
and this is not:
I have the latest mypy as of today:
The text was updated successfully, but these errors were encountered: