Finding a home for state

Chapter 1 of 4 · 5 lessons

Prerequisite: familiarity with Python variables, functions, dictionaries, lists, conditionals, and exceptions. No prior class design is assumed. Run each Python block independently with Python 3.

A calculation may need only inputs and a function. A long-lived record has another concern: its current values must remain connected to the rules that use them. These lessons move from the smaller choice to a class, then trace what names and attributes actually refer to.

  1. Start with a calculation
  2. Notice what must be remembered
  3. Name a kind of record
  4. Follow names and references
  5. Decide where an attribute belongs

Continue to Keeping state consistent.