File tree 1 file changed +19
-0
lines changed 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
108
108
frowned upon, since it often causes poorly readable code. However, it is okay to
109
109
use it to save typing in interactive sessions.
110
110
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
+
111
130
.. note ::
112
131
113
132
For efficiency reasons, each module is only imported once per interpreter
You can’t perform that action at this time.
0 commit comments