The following code...
import typing
func:typing.Callable[[int, float], str]
Annotates func
as a callable accepting two inputs. The two inputs are an int
and a float
. It also indicates that the return value is a string.
Is it possible to type hint something as a callable without specifying input argument types or output type?
For example:
def decorator(f:Callable):
def _(*args, **kwargs)
r = f(*map(str, args), **kwargs)
return r
return _