Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-43224: Implement PEP 646 changes to typing.py#31021
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
mrahtz commented Jan 30, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
pradeep90 left a comment
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.
(Reviewed three-fourths of it and got tired after a couple of hours. Will review the rest after the changes.)
Overall, I think we'd want to try other things beyond Unpack[Ts]: Unpack[tuple[int, ...]], Unpack[tuple[int, str]], and Unpack[tuple[int, Unpack[Ts], str]]. I've tried to point to cases inline.
I'd assumed all these comments had been posted weeks ago - I'd missed the part where you actually have to click the 'Submit code review' button to post them! Uff.
Ah, that clears up a mystery :) I was wondering why many comments were unaddressed.
Do we need to validate *args: <foo> somewhere? For example, *args: Ts vs *args: Unpack[Ts].
What if someone tries Union[*Ts] or Union[Ts]? Same for other special forms that call _type_check:
ClassVarOptionalFinal(i.e.,x: Final[Ts])TypeGuard- What about
Concatenate[Ts, P]andConcatenate[*Ts, P]?
n00b question: how do I run the Python tests in my local clone of this repository? Wanted to experiment.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
JelleZijlstra commented Feb 1, 2022
First compile Python, as explained in "Quick reference" at https://devguide.python.org/. To run just the typing tests, the easiest way is just |
pradeep90 commented Feb 1, 2022
Thanks, Jelle. Should have RTFM'ed but was being lazy :| @mrahtz Some tests fail locally (and on CI, apparently). |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
mrahtz commented Feb 2, 2022
@gvanrossum@JelleZijlstra@pradeep90 There's a high-level design point I've just realised we should discuss. In the PEP itself, we stated that (@gvanrossum, in case you haven't followed the chain of comments on the PR so far, there were two main reasons to try doing it this way: 1. It means we can avoid the need for a middleman classes This raises two questions:
|
JelleZijlstra commented Feb 2, 2022
Thanks for bringing this up! Here are my takes:
|
gvanrossum commented Feb 2, 2022
Exactly what Jelle says. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ds compatibility now
mrahtz commented Feb 6, 2022
@JelleZijlstra@gvanrossum Thanks for confirming re |
JelleZijlstra commented Mar 4, 2022
(Fixed a merge conflict) |
mrahtz commented Mar 5, 2022
On the subject of what to do about type substitution, Pradeep had the excellent idea of moving discussion to a future PR, given how long even this PR has taken. For now I've excised all the extra logic required, instead raising For what it's worth, though, given that both Pradeep and Jelle lean towards thinking simple is better, for the follow-up PR, I'll try drafting a prototype of Jelle's suggestion: having the subscription operator just return a new GenericAlias. |
mrahtz commented Mar 5, 2022
P.S. bedevere-bot: I have made the requested changes; please review again. |
bedevere-bot commented Mar 5, 2022
Thanks for making the requested changes! @JelleZijlstra: please review the changes made to this pull request. |
JelleZijlstra left a comment
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.
Let's do it.
I'm planning to merge this PR once 3.11.0a6 is out (cc @gvanrossum@Fidget-Spinner).
JelleZijlstra commented Mar 8, 2022
Congratulations! |
gvanrossum commented Mar 8, 2022
Thanks @mrahtz for the code, and thanks @JelleZijlstra for the review. Thanks @pradeep90 for your help. This is a monumental change! |
mrahtz commented Mar 9, 2022
Fantastic! Thank you @JelleZijlstra and @pradeep90 for the review, and @gvanrossum for your continuing support :) |
Uh oh!
There was an error while loading. Please reload this page.
These are the parts of the old PR (#30398) relevant to
typing.py.Note that we haven't yet merged the grammar PR (#31018), so for the time being all the tests just use
Unpack. We can add tests using the actual star operator in a future PR.https://bugs.python.org/issue43224