bpo-43224: Implement PEP 646 changes to typing.py by mrahtz · Pull Request #31021 · python/cpython (original) (raw)
(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
:
ClassVar
Optional
Final
(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.