Packages
Packages allow a collection of modules to be grouped under a common package name. This technique helps resolve namespace conflicts between module names used in different applications. A package is defined by creating a directory with the same name as the package and creating the file __init__.py in that directory. You can then place additional source files, compiled extensions, and subpackages in this directory, as needed. For example, a package might be organized as follows:
Graphics/ __init__.py Primitive/ __init__.py lines.py fill.py text.py ... Graph2d/ __init__.py plot2d.py ... Graph3d/ __init__.py plot3d.py ... Formats/ __init__.py gif.py png.py tiff.py jpeg.py
The import statement is used to load modules from a package in a number ...
Get Python: Essential Reference, Third Edition 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.