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)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay