-
-
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
mypy does not recognize tuple unpacking syntax for TypeVars. #11655
Comments
It is really not a big issue, but I'm curious as to why it is not working. mypy uses a different parser than cpython? or, am i using mypy incorrectly? |
Mypy recognizes specific syntactic patterns as TypeVar definitions, and this isn't one of them. I suppose we could add support, but I'm not sure that would be an improvement. |
thanks for the reply. i'm relatively new to using mypy, but my impression (so far) is that you do not have to learn a new (mypy-specific) syntax. everything you write is just a plain python (to me). now, this particular example shows that mypy requires a special syntax, and some valid python statements may not work with mypy. if that's the case, then there might be more exceptions. no? for me, |
mypy doesn't actually run any of your code (which is a feature! code can do all kinds of nasty things), and so will not always understand your code perfectly. I'd accept a PR that either provides a clearer error or accepts the multiple definition (look in semanal.py). |
There are quite a lot of places where we require strict I think that we can actually change all of these places. Because, using |
Bug Report
This is really a minor issue, but if you declare multiple TypeVar variables in one line, mypy does not seem to recognize them as type variables. For example,
To Reproduce
Expected Behavior
The
T1
andT2
in the example above should be recognized as type variables.They should pass mypy check.
Actual Behavior
Errors:
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: