Typing Callable

#python #programming #doc #typing

  • Syntax: Callable[[ParamType1,ParamType2],ReturnType1]
  • Covariance: When the return type is subtype of the passing variable
  • Contravariance: When the parameter type is not subtype of the passing variable

References

  • Ramalho, 2022, p291-295
Links to this page
#python #programming #doc #typing