-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Literal ellipsis and literal tuples #9140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From looking at typeshed, you should be able to annotate Ellipsis as The tuple thing is because the AST is the same whether or not you put the parens in, so mypy can't (easily) distinguish between |
There seems to be no further action required. |
Based on, among others, #8240 there seems to be a desire to either make |
You should probably petition the CPython project to add that type to |
Yeah, that would be the most definitive solution; I just opened bpo-41810 for the (re-)introduction request. |
I'm trying to determine how to annotate ellipsis (
...
) and I'm getting an error that...
is invalid fortyping.Literal
- is there a correct way to annotate a variable to indicate that it may contain ellipsis?I also, out of curiosity, tried using a tuple as an element in
Literal
and got an unexpected result in that it appears the tuple is unpacked (e.g.Literal[("a", "b")] == Literal["a", "b"]
) which may be correct, but surprised me :)Inputs:
Output:
Versions:
The text was updated successfully, but these errors were encountered: