Merged
Conversation
This is an edit of the TypedDict spec for clarity and flow. My goal was to unify the pieces of the spec that derive from the various PEPs into a coherent whole. I removed excessive examples and motivations: the spec should specify, not justify. The length of the spec chapter is reduced by more than half. This change is on top of python#2068 (adding PEP 728). The general approach I took is to first define the kinds of TypedDicts that can exist, then explain the syntax for defining TypedDicts, then discuss other aspects of TypedDict types. I introduce some new terminology around PEP 728 to make it easier to talk about the different kinds of TypedDict. TypedDicts are defined to have a property called openness, which can have three states: - Open: all TypedDicts prior to PEP 728 - Closed: no extra keys are allowed (closed=True) - With extra items: extra_items=... from PEP 728 I retained existing text where it made sense but also wrote some from scratch.
Member
Author
|
Posted about this on Discuss: https://discuss.python.org/t/revision-of-the-typeddict-spec/102675 |
jorenham
reviewed
Aug 17, 2025
Contributor
jorenham
left a comment
There was a problem hiding this comment.
I picked some nits; hope you don't mind.
PIG208
reviewed
Aug 17, 2025
PIG208
left a comment
There was a problem hiding this comment.
Went through the changes and left some comments. Looks good to me overall!
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Member
Author
|
Thanks for the feedback! I pushed some changes. |
carljm
approved these changes
Aug 19, 2025
Member
carljm
left a comment
There was a problem hiding this comment.
Looks good to me, and much clearer! Thank you.
37 tasks
rchen152
approved these changes
Aug 20, 2025
Collaborator
rchen152
left a comment
There was a problem hiding this comment.
Awesome, this is much better organized than before!
5 tasks
erictraut
previously requested changes
Aug 23, 2025
Collaborator
erictraut
left a comment
There was a problem hiding this comment.
Thanks for doing this @JelleZijlstra!
I left some comments for you to review regarding equivalency vs consistency.
Eric signed off on the PR here: #2072 (comment).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an edit of the TypedDict spec for clarity and flow. My goal was to
unify the pieces of the spec that derive from the various PEPs into a coherent
whole. I removed excessive examples and motivations: the spec should specify,
not justify. The length of the spec chapter is reduced by more than half.
The general approach I took is to first define the kinds of TypedDicts that
can exist, then explain the syntax for defining TypedDicts, then discuss
other aspects of TypedDict types.
I introduce some new terminology around PEP 728 to make it easier to talk
about the different kinds of TypedDict. TypedDicts are defined to have a
property called openness, which can have three states:
I retained existing text where it made sense but also wrote some from
scratch.