File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,25 @@ Note that in general the practice of importing ``*`` from a module or package is
108108frowned upon, since it often causes poorly readable code. However, it is okay to
109109use it to save typing in interactive sessions.
110110
111+ If the module name is followed by :keyword: `as `, then the name
112+ following :keyword: `as ` is bound directly to the imported module.
113+
114+ ::
115+
116+ >>> import fibo as fib
117+ >>> fib.fib(500)
118+ 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
119+
120+ This is effectively importing the module in the same way that ``import fibo ``
121+ will do, with the only difference of it being available as ``fib ``.
122+
123+ It can also be used when utilising :keyword: `from ` with similar effects::
124+
125+ >>> from fibo import fib as fibonacci
126+ >>> fibonacci(500)
127+ 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
128+
129+
111130.. note ::
112131
113132 For efficiency reasons, each module is only imported once per interpreter
You can’t perform that action at this time.
0 commit comments