Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Labels
Description
Before TypeVarTuple support was megred, this is what happened when Tuple[...] was used:
Python 3.10.0 (default, Nov 1 2021, 10:24:06) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from typing import Tuple >>> Tuple[...] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/sobolev/.pyenv/versions/3.10.0/lib/python3.10/typing.py", line 309, in inner return func(*args, **kwds) File "/Users/sobolev/.pyenv/versions/3.10.0/lib/python3.10/typing.py", line 1210, in __getitem__ params = tuple(_type_check(p, msg) for p in params) File "/Users/sobolev/.pyenv/versions/3.10.0/lib/python3.10/typing.py", line 1210, in <genexpr> params = tuple(_type_check(p, msg) for p in params) File "/Users/sobolev/.pyenv/versions/3.10.0/lib/python3.10/typing.py", line 173, in _type_check raise TypeError(f"{msg} Got{arg!r:.100}.") TypeError: Tuple[t0, t1, ...]: each t must be a type. Got Ellipsis. Since 3.11 it is allowed:
Python 3.12.0a0 (heads/main-dirty:a36235d5c7, Sep 11 2022, 12:23:24) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from typing import Tuple >>> Tuple[...] typing.Tuple[...] What should we do?
- Keep this as-is, provide a test that this is allowed (I don't know why anyone would use
tuple[...]) - Make sure that it is still an error with newer version: fix regression and add a test case
In both case I would like to send a PR :)
Related:
CC @JelleZijlstra and @Fidget-Spinner