GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — bpo-43224: Add tests for TypeVarTuple substitution in Annotated by mrahtz · Pull Request #31846 · python/cpython Conversation
|
| raise TypeError("Annotated[...] should be used " | ||
| "with at least two arguments (a type and an " | ||
| "annotation).") | ||
| if _is_unpacked_typevartuple(params[0]): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to explicitly disallow this at runtime.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hmm, but then how should we handle situations like this?
A = Annotated[Unpack[Ts], "foo"] B = A[int, str]
Annotated[int, str, "foo"] wouldn't be valid. We could do some kind of automatic tuple wrapping, Annotated[tuple[int, str], "foo", but that would be inconsistent with how we handle TypeVarTuple substitution elsewhere.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good point, and sorry for not responding to this earlier.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.