Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-102500: Document PEP 688 #102571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 4, 2023
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 30 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.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.