Python 3.12 Preview: Static Typing Improvements
Python’s support for static typing gradually improves with each new release of Python. The core features were in place in Python 3.5. Since then, there’ve been many tweaks and improvements to the type hinting system. This evolution continues in Python 3.12, which, in particular, simplifies the typing of generics.
In this tutorial, you’ll:
- Use type variables in Python to annotate generic classes and functions
- Explore the new syntax for type hinting type variables
- Model inheritance with the new
**kwargsmore precisely with typed dictionaries
This won’t be an introduction to using type hints in Python. If you want to review the background that you’ll need for this tutorial, then have a look at Python