Reputation: 1948
I like to make sure that I have accurate type hints, but how can I write the type of this function using typing.Callable
?
def f(x: int, *args, **kwargs):
pass
e.g.
Callable[[int, ?????], None]
Upvotes: 2
Views: 1079
Reputation: 7164
Paraphrasing from the documentation of type hints:
You can use Callable[[Arg1Type, Arg2Type], ReturnType]
to specify the input arguments and the ReturnType
.
If the types of the input arguments are not known, you could use the ellipsis notation instead: Callable[..., ReturnType].
Upvotes: 1