Closed erictraut closed 10 months ago
Thanks, I signed off. Linking to this post where I list some possibly confusing consequences of this decision: https://discuss.python.org/t/what-are-the-subtyping-rules-for-tuple-t/39837/77
I signed off. GH did something weird, I hope I didn't accidentally sign off for @rchen152 ?
Looks like Rebecca signed off for herself (in case you don't know: you can see the edit history if you click on the "edited by gvanrossum" gray text at the top of Eric's post).
Yes, I signed off for myself =) I edited the comment at the same time to fix the spelling of my name, which I guess might have caused the weirdness.
to fix the spelling of my name
Oops. Apologies for misspelling your name. :(
to fix the spelling of my name
Oops. Apologies for misspelling your name. :(
No worries!
@hauntsaninja, let me know if you have any concerns or questions.
Thanks! I had two comments on the PR.
Also mypy and pyright currently differ on whether this is allowed:
def takes_at_least_one(x: tuple[int, *tuple[int, ...]]): ...
def takes_var(x: tuple[int, ...]):
takes_at_least_one(x)
Just wanted to confirm whether the spec says something about this case and I missed it.
I'd like to request that the TC consider adoption of a new chapter in the typing spec that spells out type checking behaviors related to tuples.
TC Sign-off
Links to PR & Discussion The PR can be found here. The latest draft incorporates feedback from PR reviews and the discussion.
The discussion can be found here.
Current Type Checker Behaviors The latest published version of pyright (1.1.348) mostly conforms to the spec, although it doesn't correctly handle some nested unpacked tuple types.
The latest published version of mypy (1.8.0) mostly conforms to the proposed spec, but it has some false negatives for invalid unpacked tuple types. These should be straightforward to fix and shouldn't represent any backward compatibility issue for mypy users.
I haven't done a detailed analysis of pyre or pytype, but one obvious change that they will need to make is with regard to the special casing for
tuple[Any, ...]
specified in the proposed spec change.Controversial Issues I don't think there are any controversial issues with the latest draft of the proposed spec change.