Skip to content

Using ellipsis in a TypeVarTuple #1790

Answered by erictraut
MilanStaffehl asked this question in Q&A
Discussion options

You must be logged in to vote

The ... token isn't allowed in the specialization of a class parameterized by a TypeVarTuple. It's allowed only for the tuple class as discussed here in the typing spec.

You can use an unpacked tuple to specialize a class parameterized with a TypeVarTuple, like this:

x: Shape[*tuple[int, ...]]

For more information, refer to the TypeVarTuple section of the typing spec.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by MilanStaffehl
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