Consider the function:
def mysum(x)->int:
s = 0
for i in x:
s += i
return s
The argument x can be list[int] or set[int], it can also be d.keys() where d is a dict, it can be range(10), as well as any other iterable, where the item is of type int. What is the correct type-hint for x?
My python is 3.10+.
You can use
typing.Iterable:Edit:
typing.Iterableis an alias forcollections.abc.Iterable, so you should use that instead, as suggested in the comments.