-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support concatenation between lists of different types #5756
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
See https://github.com/python/typeshed/pulls?q=is%3Apr++list+__add__+ for previous attempts in this area. There doesn't seem to be an issue about it yet though. |
When working with programs that use |
Just to be clear, the issue is with mypy's treatment of list and tuple literals where it isn't using typeshed's definition of |
I'm not sure anyone figured out exactly what's going on. |
Duplicate of #2383 |
In Python adding a list of strings and a list of ints results in a list of strings and ints, but currently this is not supported by typing.
Instead, we could provide an overload such that the result of the operation becomes
List[Union[int, str]]
.This also has the nice effect where
Union[str, str_subtype]
can be reduced tostr
, so it works to implement automatic promotion as well.The text was updated successfully, but these errors were encountered: