-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Adding lists of subtypes together #2383
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
Merged
This is close to python/mypy#5492. I found a fix in #2404. |
ilevkivskyi
pushed a commit
that referenced
this issue
Nov 8, 2018
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this issue
Jan 23, 2019
#2404 has been reverted. Do we have a solution for this issue? |
+1 from microsoft/pyright#1777 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using
mypy==0.620
and Python 3.6.6, the following code:fails with:
This is presumably because lists are invariant w.r.t their generic parameter, and the declration requires a
List
of the same typetypeshed/stdlib/3/builtins.pyi
Line 619 in 4e40b03
I don't know what the right solution here is -- can we just replace the
x: List[_T]
withx: List[_T_co]
and make it covariant? Or doe we need another typevar_U = TypeVar("U", bound=_T)
or something?The text was updated successfully, but these errors were encountered: