DEV Community

ouyy2
ouyy2

Posted on

How to specify tuple contents' type without knowing tuple's size for function parameter?

Hi, I'd like to specify a parameter in function as tuple whose contents are int type and I don't know tuple's size in advance. But when I code like this:

def func(t: tuple[int]):
    pass
Enter fullscreen mode Exit fullscreen mode

which may specify the size of t to 1.
I'd like to know how to resolve this question for not knowing the size of t when I define the function?

Thanks a lot.

Top comments (0)