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 ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.