Begin Constructor Arguments Property
Evaluating an object constructor is very similar to evaluating a function call. LW Python starts by pushing the constructor's arguments into the "Arguments" stack. More formally,
if the following are true:
- expression state at time t = "begin_expr"
- the expression at time t = Python constructor with name: class_name and arguments: args
then arguments stack at time (t + 1) = [ args, arguments stack at time t ]
if the following are true:
- expression state at time 9 = "begin_expr"
- the expression at time 9 =
Person("John", "Smith", 25)
then arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ]
Try stepping through the simulator to see the arguments get pushed into the "Arguments" stack.
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments