Skip to content

class ellipsis is public but shouldn't #3556

Closed as not planned
Closed as not planned

Description

@davidhalter

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?

Activity

  1. JelleZijlstra commented on Jan 2, 2020

    @JelleZijlstra
    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.)

  2. davidhalter commented on Jan 2, 2020

    @davidhalter
    ContributorAuthor

    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.

  3. srittau commented on Jan 5, 2020

    @srittau
    Collaborator

    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.

  4. davidhalter commented on Jan 5, 2020

    @davidhalter
    ContributorAuthor

    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.

  5. gvanrossum commented on Nov 23, 2020

    @gvanrossum
    Member

    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)

  6. AlexWaygood commented on Jun 12, 2022

    @AlexWaygood
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions