-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 705: Simplify and clarify proposal #3504
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
Conversation
5b38342 to
0a7bdc4
Compare
0a7bdc4 to
1304dc7
Compare
1304dc7 to
d304a08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current changes look good to me — at least sufficient for getting another round of feedback from the broader typing community.
Co-authored-by: Jelle Zijlstra <[email protected]>
I believe the typeshed is not *unsound* here, merely stricter than necessary. Consensus is that PEPs should dictate the typeshed only, and I think this is best left to a separate PEP.
Typecheckers are always permitted to widen what they support beyond what the typeshed dictates, e.g. to specify that `c: C = a | b` and `d: D = copy(a)` should match the equivalent expressions `c: C = {**a, **b}` and `d: D = {**a}`
|
Re-requesting review as I have made significant changes: the sections on merge and copy/deepcopy have been removed, with explanation on Rejected Alternatives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a couple of minor comments, but I think this draft is looking really good!
|
Admin question: when this merges, should I continue to use the existing discussion thread on typing-sig, and just post an update? Or should I open a new one? |
I think you should continue the existing thread. Not sure we have firm guidelines, but I would only start a new thread if the proposal becomes radically different or the thread has become very long. |
Address feedback from @erictraut, plus fix issues I spotted in the process:
readonly=Trueappears to be more confusing than expected, and is not strictly necessary, so remove it (see Rejected Alternatives for more)There is no explicit name given in the Python docs ford1 | d2, but "merge" is clearer than "union", which is used for setsThe merge section incorrectly required consistency betweenAandC, even if the value inAcould never end up inCdue to it being required inBThe merge section incorrectly allowed keys to be missed offAandBin a way that could allow unsound typingother_keysis no longer an option for safe updates to TypedDicts with read-only entries, highlight that updates are safe if the bottom type is used to explicitly exclude a key, and require type checker supportcopyanddeepcopywere mentioned as having similar behaviour to merge, but it was not clear if this was intended to change how type checkers behave; add a new section explicitly laying out how copy and deepcopy should work for TypedDicts, so this can be discussed📚 Documentation preview 📚: https://pep-previews--3504.org.readthedocs.build/