Skip to content
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

class ellipsis is public but shouldn't #3556

Closed
davidhalter opened this issue Dec 22, 2019 · 6 comments
Closed

class ellipsis is public but shouldn't #3556

davidhalter opened this issue Dec 22, 2019 · 6 comments

Comments

@davidhalter
Copy link
Contributor

Ellipsis is defined like this:

# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
# not exposed anywhere under that name, we make it private here.    
class ellipsis: ...
Ellipsis: ellipsis

However I do not see how this ellipsis does not leak. Wouldn't it be better to rename ellipsis to _ellipsis or import it from somewhere and not export it again?

@JelleZijlstra
Copy link
Member

You're probably right, but I think mypy depends internally on the object being available under this name, so it might be fairly complicated to fix. (The same goes for builtins.function and builtins.module, which don't exist at runtime either.)

@davidhalter
Copy link
Contributor Author

That's why I didn't patch it. #2999 is also from me.

My opinion is this: We should get closer to what Python actually does. Mypy is not the only typeshed user and is probably also not the biggest one in terms of user numbers.

@srittau
Copy link
Collaborator

srittau commented Jan 5, 2020

I agree that we should work towards a fix, but currently mypy and typeshed are closely tied together and we can't make changes that will break mypy. This should probably be brought up in mypy's issue tracker of there isn't an issue already.

@davidhalter
Copy link
Contributor Author

This should probably be brought up in mypy's issue tracker of there isn't an issue already.

Opened python/mypy#8240. Hopefully that helps.

typeshed are closely tied together and we can't make changes that will break mypy

It's a bit unfortunate that the CI's are circular (both depend on each other). However other than that, typeshed could depend on an older version of typeshed.

@gvanrossum
Copy link
Member

gvanrossum commented Nov 23, 2020

In Python 3.10, there is now types.EllipsisType, the type of Ellispsis. We should add this to typeshed so we can change the type of Ellipsis to that (at least in 3.10+). Do we need to change mypy for this as well?

References: https://bugs.python.org/issue41810, python/cpython#22336, python/typing#684 (comment)

@AlexWaygood
Copy link
Member

Closing as we now have #7580, and I don't think we need both issues to be open when they're about the same thing.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants