我无法弄清楚如何正确注释此代码:
from typing import Iterable
def f(*params: Iterable) -> str:
return ":".join(params)
我知道这Iterable
是不正确的,因为 mypy 告诉我:
error: Argument 1 to "join" of "str" has incompatible type Tuple[Iterable[Any], ...]; expected Iterable[str]
……但我不明白为什么。