Skip to content

TypeVarTuple and Cartesian Product of functions #1545

Answered by Daverball
randolf-scholz asked this question in Q&A
Discussion options

You must be logged in to vote

This just isn't possible yet, this would require something like a Map construct to apply a type to each element of the TypeVarTuple, (although this case is even more complex since there's two TypeVarTuple that both need to be mapped at the same time)

Right now you can only unpack a TypeVarTuple directly into other variadic generics (i.e. tuple, Callable, Union and any user-defined generics that take a TypeVarTuple).

P.S. Wouldn't you need to use varargs for it to actually be the cartesian product of functions? The definition to me looks like the resulting function is supposed to have as many arguments as input functions, not one argument that's a tuple of all the inputs.

def prod_fn(*funcs: 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Daverball
Comment options

Answer selected by randolf-scholz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants