Summary
In this chapter, we've looked at the higher-level ways to organize software. A function contains many statements, a class contains many method functions, and a module can contain many classes and functions. A package can contain many modules.
We've looked at a number of ways of executing a Python script. We have a great deal of flexibility because there are many contexts in which we need to execute software. Generally, we'll focus on executing Python programs by module name rather than by filename. The distinction is tiny. Since a module must be on the search path, we can create a directory that contains the script and any supporting modules and libraries, and ensure that this directory is named on the PYTHONPATH
.
We've looked at how we can create library modules that contain definitions and will be imported into other scripts. This is our primary method of reuse. We've also looked at how we can create a script, that is reusable as a library module. This supports...