How local variables work in Python bytecode

Local variables are stored on the stack. This line tormented me for years. I could spout it in an interview, but I didn’t really know what it meant. I could pull up the diagram showing the stack growing upwards and the heap growing downwards. And I definitely didn’t want to think about what happened if they ever crossed. But to truly understand? I had to build it myself. This post explains how…