Show More
@@ -19,7 +19,22 b' Authors:' | |||||
19 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
20 |
|
20 | |||
21 | def import_item(name): |
|
21 | def import_item(name): | |
22 |
"""Import and return bar given the string foo.bar. |
|
22 | """Import and return ``bar`` given the string ``foo.bar``. | |
|
23 | ||||
|
24 | Calling ``bar = import_item("foo.bar")`` is the functional equivalent of | |||
|
25 | executing the code ``from foo import bar``. | |||
|
26 | ||||
|
27 | Parameters | |||
|
28 | ---------- | |||
|
29 | name : string | |||
|
30 | The fully qualified name of the module/package being imported. | |||
|
31 | ||||
|
32 | Returns | |||
|
33 | ------- | |||
|
34 | mod : module object | |||
|
35 | The module that was imported. | |||
|
36 | """ | |||
|
37 | ||||
23 | package = '.'.join(name.split('.')[0:-1]) |
|
38 | package = '.'.join(name.split('.')[0:-1]) | |
24 | obj = name.split('.')[-1] |
|
39 | obj = name.split('.')[-1] | |
25 |
|
40 |
General Comments 0
You need to be logged in to leave comments.
Login now