Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fbee8824
Commit
fbee8824
authored
Feb 25, 2018
by
Mario Corchero
Committed by
Mariatta
Feb 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041)
parent
84c4b0cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
Doc/tutorial/modules.rst
Doc/tutorial/modules.rst
+19
-0
No files found.
Doc/tutorial/modules.rst
View file @
fbee8824
...
...
@@ -112,6 +112,25 @@ Note that in general the practice of importing ``*`` from a module or package is
frowned
upon
,
since
it
often
causes
poorly
readable
code
.
However
,
it
is
okay
to
use
it
to
save
typing
in
interactive
sessions
.
If
the
module
name
is
followed
by
:
keyword
:`
as
`,
then
the
name
following
:
keyword
:`
as
`
is
bound
directly
to
the
imported
module
.
::
>>>
import
fibo
as
fib
>>>
fib
.
fib
(
500
)
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
This
is
effectively
importing
the
module
in
the
same
way
that
``
import
fibo
``
will
do
,
with
the
only
difference
of
it
being
available
as
``
fib
``.
It
can
also
be
used
when
utilising
:
keyword
:`
from
`
with
similar
effects
::
>>>
from
fibo
import
fib
as
fibonacci
>>>
fibonacci
(
500
)
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
..
note
::
For
efficiency
reasons
,
each
module
is
only
imported
once
per
interpreter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment