Type hints
Links:β
- [GitHub] Python-typing-koans - A set of examples to learn optional static typing in Python.
- Adam Johnson's series of post about type hints
- An introduction to Python 3.9 annotated type hints
- PEP 593 β Flexible function and variable annotations - Python 3.9 added PEP 593. It introduced a mechanism to extend the type annotations from PEP 484 which provides the standard semantic for annotations and suggested that annotations be used for type hinting.
- advanced-python-typing Series' Articles
- [GitHub] Plan to annotate - Celery
- [GitHub] Plan to annotate - Kombu
- Python Type Hints (2019)
- Type Check Your Django Application
- A deep dive on Python type hints
- Python Typing with mypy: Progressive Type Checking on a Large Code Base (2021)
- Tests arenβt enough: Case study after adding type hints to urllib3 (2021)
- TIL: typing.Protocol Across Python Versions
- I Want A New Duck (2020) -
typing.Protocol
and the future of duck typing - Use immutable collections as annotations whenever possible. - prefer
def sum_valid(data: Sequence[int | None]):
overdef sum_valid(data: list[int | None]):
- Fully-typed Python decorator with optional arguments
- Exhaustiveness Checking with Mypy
- The different uses of Python type hints (2023)
- Python Type Hints: pyastgrep case study (2023)
- Type hinting in modern Python: The Protocol class