In the docs for the Python typing package, it says:
It is possible to declare the return type of a callable without specifying the call signature by substituting a literal ellipsis for the list of arguments in the type hint:
Callable[..., ReturnType].
On the other hand, it also says:
Callable[..., ReturnType](literal ellipsis) can be used to type hint a callable taking any number of arguments and returning ReturnType.
I want to express a function that takes no arguments but returns a string. The ellipsis seems to indicate that there are some unspecified arguments. I want to express that that there definately are zero arguements.
Do I have any alternatives to using Callable[..., str] in my type hint?

所有评论(0)