There are two approaches to designing the contents of a library module. Some modules are an integrated whole, while others are more like a collection of loosely related items. When we've designed a module as a whole, it will often have a few classes or functions that are the public-facing API of the module. When we've designed a module as a collection of loosely related items, each individual class or function tends to stand alone.
We often see this distinction in the way we import and use a module. We'll look at three variations:
- Using the import some_module command: This leads to the some_module.py module being evaluated and the resulting objects are collected into a single namespace called some_module. This requires us to use qualified names for all of the objects in the module, for example, some_module.this and some_module...