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

Include "import as" in tutorial #75635

Closed
svenyonson mannequin opened this issue Sep 13, 2017 · 18 comments
Closed

Include "import as" in tutorial #75635

svenyonson mannequin opened this issue Sep 13, 2017 · 18 comments
Assignees
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@svenyonson
Copy link
Mannequin

svenyonson mannequin commented Sep 13, 2017

BPO 31454
Nosy @bitdancer, @berkerpeksag, @Mariatta, @mariocj89, @novel-yet-trivial, @miss-islington
PRs
  • bpo-31454: Include information about "import X as Y" in tutorial #4041
  • bpo-31454 : Included "Import as" in tutorial. #4195
  • [3.6] bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041) #5894
  • [3.7] bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041) #5895
  • [2.7] bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041) #5896
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/Mariatta'
    closed_at = <Date 2018-02-25.19:16:37.011>
    created_at = <Date 2017-09-13.15:52:20.230>
    labels = ['easy', 'type-feature', '3.7', 'docs']
    title = 'Include "import as" in tutorial'
    updated_at = <Date 2018-02-25.19:38:26.871>
    user = 'https://bugs.python.org/svenyonson'

    bugs.python.org fields:

    activity = <Date 2018-02-25.19:38:26.871>
    actor = 'miss-islington'
    assignee = 'Mariatta'
    closed = True
    closed_date = <Date 2018-02-25.19:16:37.011>
    closer = 'Mariatta'
    components = ['Documentation']
    creation = <Date 2017-09-13.15:52:20.230>
    creator = 'svenyonson'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31454
    keywords = ['patch', 'easy']
    message_count = 18.0
    messages = ['302083', '302095', '302102', '302183', '302184', '302189', '302198', '302202', '302297', '302301', '305356', '305594', '312833', '312838', '312842', '312846', '312847', '312848']
    nosy_count = 8.0
    nosy_names = ['r.david.murray', 'docs@python', 'berker.peksag', 'Mariatta', 'mariocj89', 'svenyonson', 'nyt', 'miss-islington']
    pr_nums = ['4041', '4195', '5894', '5895', '5896']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31454'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']

    @svenyonson
    Copy link
    Mannequin Author

    svenyonson mannequin commented Sep 13, 2017

    I was wondering if you could do something like fiblib = import fibo or import fibo as fiblib, and low and behold, the "as" variant worked. I find this very useful, and thought it should be part of your documentation on "import"

    @svenyonson svenyonson mannequin assigned docspython Sep 13, 2017
    @svenyonson svenyonson mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Sep 13, 2017
    @bitdancer
    Copy link
    Member

    Where do you find that it is not documented that you would expect it to be? Because 'import' 'as' is certainly documented.

    @Mariatta
    Copy link
    Member

    import as is documented, so I'm closing this unless you have other concerns.

    Python 3 docs: https://docs.python.org/3/reference/simple_stmts.html#import

    If the module name is followed by as, then the name following as is bound directly to the imported module
    

    Wording is somewhat different in Python 2.7 docs, but it's there: https://docs.python.org/2.7/reference/simple_stmts.html#the-import-statement

    Thanks.

    @svenyonson
    Copy link
    Mannequin Author

    svenyonson mannequin commented Sep 14, 2017

    In the 2.7 Tutorial, section 6, modules, where it describes the various syntax for using import.

    On Sep 13, 2017, at 10:42 AM, R. David Murray <report@bugs.python.org> wrote:

    R. David Murray added the comment:

    Where do you find that it is not documented that you would expect it to be? Because 'import' 'as' is certainly documented.

    ----------
    nosy: +r.david.murray


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue31454\>


    @svenyonson
    Copy link
    Mannequin Author

    svenyonson mannequin commented Sep 14, 2017

    My suggestion was to include this in the 2.7 tutorial, section 6 (modules) where the various syntax is described for import. Most of us don't dig into the reference until we are trying to find something specific. The tutorial is an excellent place to introduce useful but not obvious features of the language.

    On Sep 13, 2017, at 12:15 PM, Mariatta Wijaya <report@bugs.python.org> wrote:

    Mariatta Wijaya added the comment:

    import as is documented, so I'm closing this unless you have other concerns.

    Python 3 docs: https://docs.python.org/3/reference/simple_stmts.html#import

    If the module name is followed by as, then the name following as is bound directly to the imported module
    

    Wording is somewhat different in Python 2.7 docs, but it's there: https://docs.python.org/2.7/reference/simple_stmts.html#the-import-statement

    Thanks.

    ----------
    nosy: +Mariatta
    resolution: -> not a bug
    stage: -> resolved
    status: open -> closed


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue31454\>


    @bitdancer
    Copy link
    Member

    I agree that it would seem reasonable to add this to section 6.1 of the tutorial, since it mentions both import statement variants and the modules "global symbol table", which are the two concepts involved in import as.

    Would you like to propose a PR?

    @bitdancer bitdancer reopened this Sep 14, 2017
    @bitdancer bitdancer removed the invalid label Sep 14, 2017
    @bitdancer bitdancer changed the title Include "import as" in documentation Include "import as" in tutorial Sep 14, 2017
    @bitdancer bitdancer added the 3.7 (EOL) end of life label Sep 14, 2017
    @svenyonson
    Copy link
    Mannequin Author

    svenyonson mannequin commented Sep 14, 2017

    I don't know what a PR is, so I'll let you guys handle it if it is OK with you.

    On Sep 14, 2017, at 11:47 AM, R. David Murray <report@bugs.python.org> wrote:

    R. David Murray added the comment:

    I agree that it would seem reasonable to add this to section 6.1 of the tutorial, since it mentions both import statement variants and the modules "global symbol table", which are the two concepts involved in import as.

    Would you like to propose a PR?

    ----------
    resolution: not a bug ->
    stage: resolved -> needs patch
    status: closed -> open
    title: Include "import as" in documentation -> Include "import as" in tutorial


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue31454\>


    @bitdancer
    Copy link
    Member

    Well, this is all volunteer work. Maybe someone else will feel like doing it :)

    @merwok merwok added the easy label Sep 15, 2017
    @novel-yet-trivial
    Copy link
    Mannequin

    novel-yet-trivial mannequin commented Sep 15, 2017

    The offending file is here: https://github.com/python/cpython/blob/master/Doc/tutorial/modules.rst

    Read the developer's guide to learn how to submit your changes to python. https://devguide.python.org/

    @Mariatta
    Copy link
    Member

    I might know an aspiring contributor who can work on this. Assigning to myself.

    @Mariatta Mariatta assigned Mariatta and unassigned docspython Sep 15, 2017
    @berkerpeksag
    Copy link
    Member

    I just reviewed Mario's pull request. Should we mention the "from fibo import fib as fibonacci" syntax too?

    @berkerpeksag
    Copy link
    Member

    PR 4041 looks good to me. Mariatta, do you have time to look at Mario's patch?

    Sarthak, thank you for your PR, but a PR was opened 12 days before yours (sorry, I missed it earlier) Would you like to work on another issue? I've just opened bpo-31948 and I'd be happy to review/merge a PR if you have time. Thanks!

    @Mariatta
    Copy link
    Member

    PR 4041 looks good to me. Mariatta, do you have time to look at Mario's patch?

    Sorry I just saw this now, months later.
    Looks good to me. I can merge and backport once the CI passed.
    Thanks!

    @Mariatta
    Copy link
    Member

    New changeset fbee882 by Mariatta (Mario Corchero) in branch 'master':
    bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041)
    fbee882

    @Mariatta
    Copy link
    Member

    Thanks everyone. I've merged Marios's PR. The backport PRs have started and will automerge.

    @miss-islington
    Copy link
    Contributor

    New changeset 5a07608 by Miss Islington (bot) in branch '3.6':
    bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041)
    5a07608

    @miss-islington
    Copy link
    Contributor

    New changeset e48e649 by Miss Islington (bot) in branch '3.7':
    bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041)
    e48e649

    @miss-islington
    Copy link
    Contributor

    New changeset 7634947 by Miss Islington (bot) in branch '2.7':
    bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041)
    7634947

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life docs Documentation in the Doc dir easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants