Suppose I have a function like this:
def foo(*args):
for x in args:
print(x)
and say, I want to say that all elements argsare equal int; What is the correct way to express this as PEP 0484 ? Should I do something like
from typing import Tuple
def foo(*args: Tuple[int, ...]) -> None:
for x in args:
print(x)
or something like
def foo(*args: int) -> None:
for x in args:
print(x)
or something else?
In particular, I'm trying to make good use of type hints in PyCharm, and none of the solutions that I thought of seems to help PyCharm figure out what it xshould be int.
source
share