-
-
Notifications
You must be signed in to change notification settings - Fork 29.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
Include "import as" in tutorial #75635
Comments
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" |
Where do you find that it is not documented that you would expect it to be? Because 'import' 'as' is certainly documented. |
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
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. |
In the 2.7 Tutorial, section 6, modules, where it describes the various syntax for using import.
|
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.
|
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? |
I don't know what a PR is, so I'll let you guys handle it if it is OK with you.
|
Well, this is all volunteer work. Maybe someone else will feel like doing it :) |
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/ |
I might know an aspiring contributor who can work on this. Assigning to myself. |
I just reviewed Mario's pull request. Should we mention the "from fibo import fib as fibonacci" syntax too? |
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! |
Sorry I just saw this now, months later. |
Thanks everyone. I've merged Marios's PR. The backport PRs have started and will automerge. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: