-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Supporting Ellipsis as a value #7818
Comments
This would have to fixed/changed in Python first. If this gets changed in Python, mypy will add support to it, but I'm not sure if this is a common enough use case to add non-standard syntax for this type. If you want to move this forward, you can propose something at https://github.com/python/typing/issues. |
Thanks @JukkaL , I'll open an issue in that repo. Feel free to close this |
Py3.11:
So... Python seems to allow it, at run time at least. |
@max-sixty Have you opened the issue elsewhere? What was the end of your story? |
Issue linked above! |
We use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean "everything else".
But it's not possible to use fully with type checking, since mypy doesn't exclude it from a type when it's been excluded with an
if
, as it does forNone
, orEnum
s per python/typing#240).I've included below a MCVE of the behavior below, and here's an example of how we use it, given @gvanrossum has already asked whether it's important to use an Ellipsis:
For example, to transpose an array, these are equivalent:
I think it's a bug but Recognize comparison with Ellipsis #2180 suggests it may be a "Will not fix". Wanted to repost it here given the logic above
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
Do you see the same issue after installing mypy from Git master?
mypy 0.740
Thank you!
The text was updated successfully, but these errors were encountered: