To fully understand how Python code executes, we need to visualize what happens in the global space , the call stack where call frames live, and the heap space where objects (folders) live.

Lecture Prep

Watch:
  1. Memory Areas (5 minutes) Global space , call stack , and heap space
  2. Modules in Memory (5 minutes) What happens in memory when you import a module?
  3. Functions in Memory (6 minutes) The function definition goes into a folder, too.
  4. Global Variables (6 minutes) A function can access global variables but cannot (should not) modify their values.
  5. Optional: Objects Everywhere (7 minutes)

Lecture materials

Slides: individual slides for viewing , 6-up layout for printing

Examples: v1.py , v2.py , v3.py , shape.py
To download the above .py files, right-click (Windows) or command-click (Macs) on the filename and then select "Save link as".
This way you choose where the files will be saved, instead of having your computer save to the default folder (from which you will later have to move your files for organization).

Link to Lecture Recording