-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
'Any' with a bound? #8981
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
https://docs.python.org/3/library/typing.html#typing.TypeVar
I think it should report an error for |
The
Since it's compatible in both directions, I think |
Plain |
This issue appears to be based on a misunderstanding of how The use of Mypy is doing the right thing in how it's treating I recommend closing this issue. |
When mypy is run on the following code:
It will not report any errors. However, since
T
hasint
as a bound, assigning a string tox
should be considered invalid even if we don't know the exact type ofx
.It seems that when
Any
is substituted for the type argument ofC
, the knowledge of the bound is lost. PerhapsAnyType
could be given a bound,object
by default, to restrict which typesAny
can represent in a particular context.The text was updated successfully, but these errors were encountered: