PEP 728: Revise proposal to spec the 'extra_items=T' idea#4066
Merged
JelleZijlstra merged 6 commits intopython:mainfrom Oct 19, 2024
Merged
PEP 728: Revise proposal to spec the 'extra_items=T' idea#4066JelleZijlstra merged 6 commits intopython:mainfrom
JelleZijlstra merged 6 commits intopython:mainfrom
Conversation
2482267 to
f5a5e90
Compare
peps/pep-0728.rst
Outdated
| <https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items/45443/115>`__. | ||
|
|
||
| This will allow us to deprecate the functional syntax of defining TypedDict | ||
| types altogether, but adapting to this proposal will make this PEP heavier. |
Member
There was a problem hiding this comment.
I feel this isn't a strong argument; if this PEP is accepted, we'll be stuck with its behavior for at least many years, so we need to make sure we get it right the first time.
This proposal is nice because it also unlocks some other things that are currently awkward or impossible (keys that aren't valid identifiers), it has a few disadvantages:
- It's less apparent to a reader that
_: boolmakes the TypedDict special, relative to adding a class argument likeextra_items=bool. - It's backwards incompatible with existing TypedDicts using the
_: boolkey. While such users have a way to get around the issue, it's still a problem for them if they upgrade Python (or typing-extensions). - The types don't appear in an annotation context, so their evaluation will not be deferred.
Contributor
Author
There was a problem hiding this comment.
Added the bullet points to this section in commit d146b98. Thanks!
PIG208
added a commit
to PIG208/peps
that referenced
this pull request
Oct 18, 2024
python#4066 (comment) Signed-off-by: Zixuan James Li <[email protected]>
- Move away from '__extra_items__: T' to 'extra_items=T' - Repurpose the 'closed' class parameter to make 'closed=True' an alias of 'extra_items=Never' - Include references to the typing spec - Normalize terms like "assignability" and "consistent" to match the typing glossary (https://typing.readthedocs.io/en/latest/spec/glossary.html) - Update sections that contain documentation quotes to match the up-to-date version - Add new sections about other ideas - Bump the target version to 3.14
Some of the linked sections do not expose the label, otherwise we should be able to use intersphinx references. Signed-off-by: Zixuan James Li <[email protected]>
Signed-off-by: Zixuan James Li <[email protected]>
Signed-off-by: Zixuan James Li <[email protected]>
python#4066 (comment) Signed-off-by: Zixuan James Li <[email protected]>
JelleZijlstra
approved these changes
Oct 19, 2024
gvanrossum
pushed a commit
to gvanrossum/peps
that referenced
this pull request
Dec 10, 2024
- Move away from '__extra_items__: T' to 'extra_items=T' - Repurpose the 'closed' class parameter to make 'closed=True' an alias of 'extra_items=Never' - Include references to the typing spec - Normalize terms like "assignability" and "consistent" to match the typing glossary (https://typing.readthedocs.io/en/latest/spec/glossary.html) - Update sections that contain documentation quotes to match the up-to-date version - Add new sections about other ideas - Bump the target version to 3.14 Signed-off-by: Zixuan James Li <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
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.
PEP 123: Summary of changes)Change summary
__extra_items__: Ttoextra_items=T📚 Documentation preview 📚: https://pep-previews--4066.org.readthedocs.build/