Call Add Function End Property

When the state is "call_function_begin," the expression is an addition, and the parent stack is empty, then update the state to "end_expr." More formally:

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

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

Python finishes addition in one step, and when there is no parent expression to return to, expression evaluation is complete.

For example, if the following are true:

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

then expression state at time (10 + 1) = "end_expr"

This can be simplified to:

expression state at time 11 = "end_expr"

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

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments