We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
from typing import Tuple x = (1, 't', 2) # type: Tuple[int, str, int] z = ('t', 3) # type: Tuple[str, int] xz = x + z # type: Tuple[int, str, int, str, int]
Not only is Tuple[Any, …] the inferred type of xz, mypy won't accept the provided annotation:
Tuple[Any, …]
xz
error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "Tuple[int, str, int, str, int]")
Running this program through mypy:
from typing import TypeVar, Type, Mapping, Sequence, Generator, Tuple # noqa x = (1, 't', 2) # type: Tuple[int, str, int] z = ('t', 3) # type: Tuple[str, int] xz = x + z reveal_type(xz[0])
shows that the type of xz[0] is now Any (consistent with the inferred type).
xz[0]
Any
IMO if it's not type-theoretically onerous the inferred type of xz should be Tuple[int, str, int, str, int].
Tuple[int, str, int, str, int]
The text was updated successfully, but these errors were encountered:
Closing as duplicate of #224.
Sorry, something went wrong.
No branches or pull requests
Not only is
Tuple[Any, …]
the inferred type ofxz
, mypy won't accept the provided annotation:Running this program through mypy:
shows that the type of
xz[0]
is nowAny
(consistent with the inferred type).IMO if it's not type-theoretically onerous the inferred type of
xz
should beTuple[int, str, int, str, int]
.The text was updated successfully, but these errors were encountered: