-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Type annotations on with
statements
#1356
Labels
Comments
Yeah, PEP 484 says this should work. (Also for a |
Actually we already have an issue for this. Closing as dupe of #892. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We might not always be able to infer the type of the variable bound by a
with
statement, just like we might not always be able to infer the type of a variable being assigned to for the first time. For this minimal examplemypy reports
It would be nice to be able to write, for example,
declaring the type of
x
. This is currently rejected by mypy as a parse error.The text was updated successfully, but these errors were encountered: