Skip to content
Merged
Prev Previous commit
Next Next commit
Merge branch 'main' into pep688docs
  • Loading branch information
hauntsaninja authored Apr 28, 2023
commit 2313ac07a2c88d644c0db5eb8b2b19223f3e4bee
30 changes: 30 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,36 @@ The new :class:`inspect.BufferFlags` enum represents the flags that
can be used to customize buffer creation.
(Contributed by Jelle Zijlstra in :gh:`102500`.)

New Features Related to Type Hints
==================================

This section covers major changes affecting :pep:`484` type hints and
the :mod:`typing` module.

.. _whatsnew312-pep692:

PEP 692: Using ``TypedDict`` for more precise ``**kwargs`` typing
-----------------------------------------------------------------

Typing ``**kwargs`` in a function signature as introduced by :pep:`484` allowed
for valid annotations only in cases where all of the ``**kwargs`` were of the
same type.

This PEP specifies a more precise way of typing ``**kwargs`` by relying on
typed dictionaries::

from typing import TypedDict, Unpack

class Movie(TypedDict):
name: str
year: int

def foo(**kwargs: Unpack[Movie]): ...

See :pep:`692` for more details.

(PEP written by Franek Magiera)

Other Language Changes
======================

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.