Duck Typing vs Nominal Typing

#python #programming #typing #doc

  • Duck Typing: more flexible, only the objects has type. However, errors can happen during the executions. Which operation are supported is the important here
  • Nominal: Strict and rigid. Parameters and variables are typed as well. Code that is correct can be stated as wrong for mypy. What it is matters is the source code.

References

  • Ramalho, 2022, p260-265
#python #programming #typing #doc