Save Constructor Parameters Property
Before LW Python jumps to the "__init__" constructor, it needs to construct a new "Variables" map with the "__init__" method parameters. LW Python first copies the "__init__" method parameters to the "Parameters" list. More formally,
if the following are true:
- expression state at time t = "call_function_begin"
- the expression at time t = Python constructor with name: class_name and arguments: args
- method parameters where the Class Map is (Class Map at time t), class name is class_name, and method name is "__init__" = params
then Parameters List at time (t + 1) = params
if the following are true:
- expression state at time 20 = "call_function_begin"
- the expression at time 20 =
Person("John", "Smith", 25)
- method parameters where the Class Map is (Class Map at time 20), class name is "Person", and method name is "__init__" = [ self, [ first_name, [ last_name, [ age, [ ] ] ] ] ]
then Parameters List at time (20 + 1) = [ self, [ first_name, [ last_name, [ age, [ ] ] ] ] ]
Try stepping through the simulator to see LW Python copy the method parameters to "Parameters."
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments