2021年3月27日星期六

Is there an efficient way in Python to type hint a long tuple?

Type hinting a short tuple is easy.

Point = tuple[int, int]  

But what if instead of 2 items, there's 100. Is there something like this non-functional code?

Row = tuple[int * 100]  

I don't want it to be variable. So this is no good.

Vector = tuple[int, ...]  
https://stackoverflow.com/questions/66837572/is-there-an-efficient-way-in-python-to-type-hint-a-long-tuple March 28, 2021 at 09:06AM

没有评论:

发表评论