Skip to content

Exporting glob imports from stubs #167

Closed

Description

@o11c

It turns out that it is often necessary to reexport an entire module under a different name.

This could use glob imports, but that doesn't work in stubs since there is no from foo import * as * syntax.

For discussion, see: python/typeshed#21 and specifically o11c/typeshed@d7bf7eb#commitcomment-14039404

Activity

  1. JukkaL commented on Oct 30, 2015

    @JukkaL
    Contributor

    We can make from m import * a special case and export all public names imported that way automatically from a stub. I can't come up with another use case where from ... import * in a stub would be that useful. Mypy actually already works like this.

  2. gvanrossum commented on Oct 30, 2015

    @gvanrossum
    Member

    OK, this sounds fine. Shall I update the PEP?

    On Thu, Oct 29, 2015 at 9:56 PM, Jukka Lehtosalo notifications@github.com
    wrote:

    We can make from m import * a special case and export all public names
    imported that way automatically from a stub. I can't come up with another
    use case where from ... import * in a stub would be that useful. Mypy
    actually already works like this.

    —
    Reply to this email directly or view it on GitHub
    #167 (comment).

    --Guido van Rossum (python.org/~guido)

  3. o11c commented on Oct 30, 2015

    @o11c
    ContributorAuthor

    Also clarify that from ... import ... as ... does exports too.

  4. gvanrossum commented on Oct 30, 2015

    @gvanrossum
    Member

    Done.

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