5. The Anatomy of a Python program¶
This section details the parts of a typical Python program, introducing some basic Python structures and concepts.
Python program structure.
How does a program connect to other programs?
How do we read a program and recgnize its structure?
A key answer to question 2 is that well-written complex programs are broken up into functions. We learn a bit more about how to read, write, and understand functions.
We learn about classes. We have been using Python classes all along without making much of it. We learn about how a user can define classes, and a bit about when one would want to.
We take our first big step thoward programs that interact with the outside world, a necessary property of data collection programs as we look at files and file input/output.
- 5.1. Import statements
- 5.2. Python names and namespaces
- 5.3. Block structure
- 5.4. Functions and function parameters
- 5.5. Classes and class attributes
- 5.6. Files and file IO streams
- 5.7. Help and doc strings
- 5.8. A Python program
- 5.9. Putting it all together
- 5.10. Summary