Address feedback from JelleZijlstra#4
Merged
alicederyn merged 1 commit intopep.typedmappingfrom Feb 13, 2023
Merged
Conversation
Define what TypedMapping does support, not just what it doesn't, to clarify edge cases like ``|``.
| * No mutator methods (``__setitem__``, ``__delitem__``, ``update``, etc.) will be generated | ||
| * A class definition defines a ``TypedMapping`` protocol if and only if ``TypedMapping`` appears directly in its class bases | ||
| * Subclasses can narrow field types, in the same manner as other protocols | ||
| Notable similarities to ``TypedDict``: |
There was a problem hiding this comment.
This still reads like a tutorial, not a specification. I would frame it more around collections.abc.Mapping: TypedMapping supports the same operations as Mapping[str, object], except that the defined keys produce more precise types around methods like get and __getitem__.
Owner
Author
There was a problem hiding this comment.
Is this different from my change to line 96?
There was a problem hiding this comment.
It's not! Sorry for missing that line in the diff.
CAM-Gerlach
reviewed
Feb 10, 2023
| Author: Alice Purcell <alicederyn@gmail.com> | ||
| Sponsor: Pablo Galindo <pablogsal@gmail.com> | ||
| Discussions-To: https://mail.python.org/archives/list/python-dev@python.org/thread/2P26R4VH2ZCNNNOQCBZWEM4RNF35OXOW/ | ||
| Discussions-To: pending |
There was a problem hiding this comment.
Just FYI, the linter will go red on this and flag it, but perhaps that's intentional as a reminder to update it immediately prior to merging (if that's your plan).
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.
Define what TypedMapping does support, not just what it doesn't, to clarify edge cases like
|.