Replies: 2 comments 1 reply
|
The problem is that if a type such as def func(*a: *tuple[*Ts, *Ts2]) -> Union[*Ts, *Ts2]:
...
func(1, 2, 3, 4) |
1 reply
This is a valid when using # Matches `func(1, "a", "b", ...)
@overload
def func(arg: int, *args: str): ...
# Matches `func("a", "b", ..., 1)
@overload
def func(*args: *tuple[*tuple[str, ...], int]): ...
# Matches `func("a", "b", ..., 1, "a", "b", ...), but not valid currently
@overload
def func(*args: *tuple[*tuple[str, ...], int, *tuple[str, ...]]): ... |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
PEP 646 says that you cannot unpack multiple
TypeVarTuplesat once, but i cant think of any reason for this limitation, there shouldn't be any ambiguity in it like with having multiple variadic generics which what the reason links to.A simple use-case for this is combining tuples together:
Another language with variadic generics is C++ which does support this:
All reactions