parameter specification/type variable tuple variance#2215
parameter specification/type variable tuple variance#2215KotlinIsland wants to merge 2 commits intopython:mainfrom
Conversation
5f8e0cc to
d9d82c9
Compare
81ba400 to
54ad5e1
Compare
JelleZijlstra
left a comment
There was a problem hiding this comment.
I like adding this if we can get it specified nicely, but this PR is not ready; the proposed test is incorrect.
Also, https://typing.python.org/en/latest/spec/generics.html#paramspec-variables still says variance on ParamSpec is unsupported; this should be updated.
I'd also like to see an implementation in at least one type checker, even if only as a draft PR, so we can be confident this is something that can be feasibly implemented.
|
I personally would also like to see tests added for param spec variance inference, since that would probably need to be supported as well. |
|
The test cases do have variance inference, though as I noted some of the cases are wrong. But it would probably be useful to have a few more cases, and I'd recommend putting the tests for paramspec variance in their own file so we can track type checker support more precisely. |
I have wip support in PyCharm, but I could also add it to basedpyright it was very straightforward to implement |
Oh right, sorry I didn't see them, because I thought they would be in a different file. I'm also very much +1 on putting those tests into a different file (for example |
54ad5e1 to
8f30004
Compare
8f30004 to
117964e
Compare
discussion: https://discuss.python.org/t/parameter-specifications-should-have-variance/106452