10000 PEP 705: TypedMapping by alicederyn · Pull Request #2997 · python/peps · GitHub
[go: up one dir, main page]

Skip to content

PEP 705: TypedMapping #2997

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 20 commits into from
Mar 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add backcompat and ref implementation sections (#5)
  • Loading branch information
alicederyn authored Feb 16, 2023
commit a1bfab3851f44b812a8d2a33eee71c02a456a600
21 changes: 21 additions & 0 deletions pep-0705.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,27 @@ Discussion:
f(b) # Runtime error: int + str


Backwards Compatibility
=======================

This PEP changes the rules for how ``TypedDict`` behaves (allowing subclasses to
inherit from ``TypedMapping`` protocols in a way that changes the resulting
overloads), so code that inspects ``TypedDict`` types will have to change. This
is expected to mainly affect type-checkers.

The ``TypedMapping`` type will be added to the ``typing_extensions`` module,
enabling its use in older versions of Python. Users wanting to inherit from
both ``TypedDict`` and ``TypedMapping`` will need to use
``typing_extensions.TypedDict`` in these versions, as the ``typing`` declaration
of ``TypedDict`` does an ``is`` check on the metaclass of all base classes.


Reference Implementation
========================

No reference implementation exists yet.


Rejected Alternatives
=====================

Expand Down
0