Finally, let’s wrap up this chapter by briefly comparing the topics of this book’s last two parts: modules and classes. Because they’re both about namespaces, the distinction can be confusing. In short:
Modules
Implement data/logic packages
Are created with Python files or other-language extensions
Are used by being imported
Form the top-level in Python program structure
Classes
Implement new full-featured objects
Are created with class statements
Are used by being called
Always live within a module
Classes also support extra features that modules don’t, such as operator overloading, multiple instance generation, and inheritance. Although both classes and modules are namespaces, you should be able to tell by now that they are very different things. We need to move ahead to see just how different classes can be.