bpo-43224: Unpack concrete tuple types into a sequence of types by serhiy-storchaka · Pull Request #32030 · python/cpython
I'd rather not do this for the reasons @mrahtz explained elsewhere.
Another point: what about Unpack[Annotated[tuple[int, str], "whatever"]]?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should do this (see also @mrahtz's comment at #91162 (comment)):
- It would make
Unpack[tuple[int, str]]not the same as*tuple[int, str]. def f(*args: *tuple[int, str])would end up withintin its__annotations__because of the way we implemented*there.- For runtime users of typing, in my experience it's better to keep information around than to simplify. If we simplify, runtime introspection can't reconstruct what the user meant; if we don't simplify, tool authors can probably deal with it easily.
mrahtz
mannequin
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters