Begin Constructor Parent Property

Evaluating an object constructor is very similar to evaluating a function call. LW Python starts by pushing the expression to the parent 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 parent stack at time (t + 1) = [ Python constructor with name: class_name and arguments: args, parent stack at time t ]

For example, if the following are true:
  • expression state at time 9 = "begin_expr"
  • the expression at time 9 = Person("John", "Smith", 25)

then parent stack at time (9 + 1) = [ Person("John", "Smith", 25), parent stack at time 9 ]

Try stepping through the simulator to see LW Python push the constructor to the parent stack.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments