| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks! The tests are good but it's a bit unfortunate if we can't use Annotated around a TypeVarTuple at all.
Sorry, something went wrong.
| 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.
I don't think we need to explicitly disallow this at runtime.
Sorry, something went wrong.
There was a problem hiding this comment.
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 a problem hiding this comment.
Good point, and sorry for not responding to this earlier.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
At some point I guess we should add tests for the native tuple too, once #31828 or similar is in.
@JelleZijlstra Does this assuage the concerns you mentioned about Annotated in #31021 (review)?
@@GBeauregard too, since Jelle also mentioned you in that thread - is there anything else we should test for here?
https://bugs.python.org/issue43224