Function Call Returned Rule
If the state is "call_returned" and the parent stack is empty at time t, then at time t + 1, the state is "end_expr." More formally,
if the following are true:
- expression state at time t = "call_returned"
- parent stack at time t = [ ]
then expression state at time (t + 1) = "end_expr"
After Python has returned from the function body, the function call has finished. If the parent stack is empty, this was a top-level function call, so the expression has finished.
If the parent stack was not empty, then the returned value from the function call is used as an argument to a parent function call, and the expression evaluation continues.
For example,
if the following are true:
- expression state at time 25 = "call_returned"
- parent stack at time 25 = [ ]
then expression state at time (25 + 1) = "end_expr"
Try stepping through the simulator to see the state change to "end_expr."
Current Line | 1 | Current Tab | 0 | Time | 0 |
Comments
Please log in to add comments