May 2018
Intermediate to advanced
380 pages
9h 37m
English
We have talked about modules and packages, using the terms interchangeably. However, there is a difference between a module and a package: packages are actually collections of modules and they include a __init__.py file, which can just be an empty file.
The dot-nomenclature used in modules to access specific functions or variables is also used in packages. This time, dotted names allow multiple modules within a package to be accessed without having name conflicts; each package creates its own namespace, and all the modules have their own namespaces.
When packages contain sub-packages (as in the following example), importing modules can be done with either absolute or relative paths. For example, ...