12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter SummaryThis chapter introduced <strong>Python</strong>’s package import model—an optional but usefulway to explicitly list part of the directory path leading up to your modules. Packageimports are still relative to a directory on your module import search path, but ratherthan relying on <strong>Python</strong> to traverse the search path manually, your script gives the restof the path to the module explicitly.As we’ve seen, packages not only make imports more meaningful in larger systems,but also simplify import search path settings (if all cross-directory imports are relativeto a common root directory), and resolve ambiguities when there is more thanone module of the same name (including the name of the enclosing directory in apackage import helps distinguish between them).In the next chapter, we will survey a handful of more advanced module-related topics,such as relative import syntax, and the _ _name_ _ usage mode variable. As usual,though, we’ll close out this chapter with a short quiz to test what you’ve learnedhere.424 | Chapter 20: Module Packages

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!