12.9. Exercises
12-1. PathSearch vs. SearchPath. What is the difference between a path search and a search path?
12-2. Importing Attributes. Assume you have a function called foo() in your module mymodule. What are the two ways of import this function into your namespace for invocation?
12-3. Importing. What are the differences between using “import module” and “from module import *”?
12-4. Namespaces vs. Variable Scope. How are namespaces and variable scopes different from each other?
12-5. Using__import__().
(a) Use __import__() to import a module into your namespace. What is the correct syntax you finally used to get it working?
(b) Same as above, but use __import__() to import only specific names from modules.
12-6. Extended Import. Create a new ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access