Python typing annotating functions and callables
For functions/callables, Callable
is not the entire story: you can annotate the arguments and returns values of these callables!
From mypy documentation:
The type of a function that accepts arguments
A1
,…
,An
and returnsRt
isCallable[[A1, ..., An], Rt]
."You can only have positional arguments, and only ones without default values, in callable types
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus