File tree Expand file tree Collapse file tree
Misc/NEWS.d/next/Documentation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ Summary -- Release highlights
6666
6767.. PEP-sized items next.
6868
69+ New typing features:
70+
71+ * :ref: `whatsnew312-pep692 `
72+
6973Important deprecations, removals or restrictions:
7074
7175* :pep: `623 `, Remove wstr from Unicode
@@ -145,6 +149,36 @@ New Features
145149 In Python 3.14, the default will switch to ``'data' ``.
146150 (Contributed by Petr Viktorin in :pep: `706 `.)
147151
152+ New Features Related to Type Hints
153+ ==================================
154+
155+ This section covers major changes affecting :pep: `484 ` type hints and
156+ the :mod: `typing ` module.
157+
158+ .. _whatsnew312-pep692 :
159+
160+ PEP 692: Using ``TypedDict `` for more precise ``**kwargs `` typing
161+ -----------------------------------------------------------------
162+
163+ Typing ``**kwargs `` in a function signature as introduced by :pep: `484 ` allowed
164+ for valid annotations only in cases where all of the ``**kwargs `` were of the
165+ same type.
166+
167+ This PEP specifies a more precise way of typing ``**kwargs `` by relying on
168+ typed dictionaries::
169+
170+ from typing import TypedDict, Unpack
171+
172+ class Movie(TypedDict):
173+ name: str
174+ year: int
175+
176+ def foo(**kwargs: Unpack[Movie]): ...
177+
178+ See :pep: `692 ` for more details.
179+
180+ (PEP written by Franek Magiera)
181+
148182
149183Other Language Changes
150184======================
Original file line number Diff line number Diff line change 1+ Mention the new way of typing ``**kwargs `` with ``Unpack `` and ``TypedDict ``
2+ introduced in :pep: `692 `.
You can’t perform that action at this time.
0 commit comments