imperative / Python
Representation
Collected by Craig S. Miller — Interview, Amber Settle
Demonstrates what happens to variable values when they are passed to a function. Distinguishes frame elements among each recursive call. Shows separate stack frames, each with own parameters and variables, for each recursive call.
PL | NM |
---|---|
frame | group of elements with function name |
parameter | labeled box inside frame |
local variable | labeled box inside frame |
Addition of each stack frame as each recursive call is made. Collapse of stack frame as function completes and returns value.
When introducing recursion
Requires use and understanding of the Python Tutor visualization tool
Amber Settle presented this use of Python Tutor in an interview. She uses it to explain how recursive calls work when introducing recursion.
From the interview: Students "tend to use it a little bit mechanically so they tend to just step through it and not really think about what's actually happening on the screen."
Do you have feedback on this notional machine? Did you find a mistake, or do you have a request for improvement? You can create an Issue on GitHub, where the description is hosted. This way we can see your feedback and address it.
For this, you need a GitHub account. Then follow this link to see the source file of this page. In there, click the ... left of the highlighted line, then pick "Reference in a new issue".