You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected "..." when assigning tuple with variable length to type alias #11102
fromtypingimportTupleFoo=Tuple[int, ...]
a: Foo= (1 ,2, 3)
reveal_type(a) # note: Revealed type is "builtins.tuple[builtins.int]"
Is it that mypy can't tell whether tuple is being used as a type or a function?
fromtypingimportTuplereveal_type(Tuple[int]) # note: Revealed type is "builtins.object"reveal_type(tuple[int]) # note: Revealed type is "def (iterable: typing.Iterable[builtins.int*] =) -> builtins.tuple[builtins.int*]"
Activity
Zeckie commentedon Sep 15, 2021
This is valid (according to mypy):
Is it that mypy can't tell whether
tupleis being used as a type or a function?hauntsaninja commentedon Sep 21, 2021
I believe this was fixed (a while back) on master #10766