Annotate a tuple with variable number of items and first item is of different type

Viewed 185

A few valid values for a tuple that I'm trying to annotate:

("foo", 1, 2)
("bar", 11)
("baz", 42, 31, 20, 0, -700, 44444, 12345, 1, 2, 3, 4, 5, 6, 7, 8, 9)

I was expecting this to work:

my_tuple: Tuple[str, int, ...]  # doesn't work!

... but that throws error: Unexpected '...'

Any way to annotate this structure?

0 Answers
Related