Call Add Function Return Rule

When the state is "call_function_begin," the expression is an addition, and there is a parent expression, then update the state to "return."

if the following are true:
  • expression state at time t = "call_function_begin"
  • parent stack at time t = [ x, y ]
  • the expression at time t = function call with name: "__add__" and arguments: args

then expression state at time (t + 1) = "return"

Python is finished with addition, and it enter the "return" state to execute the parent expression next.

For example, if the following are true:

  • expression state at time 15 = "call_function_begin"
  • parent stack at time 15 = [ __add__(5, (__add__(2, 3))), [ ] ]
  • the expression at time 15 = __add__(2, 3)

then expression state at time (15 + 1) = "return"

Try stepping through the simulator to see the "Expression State" change to "return."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments