Class Statement Control Property

When LW Python sees a "class" statement, it will set an entry in the "Control" map to note that LW Python is entering the "class" body. More formally,

if the following are true:
  • the line at time t = i
  • the tab at time t = j
  • statement at line i, tab j = a class named name with bases: bases

then Control Map at time (t + 1) = result of storing (pair ("class", name)) at key: j in map: (Control Map at time t)

For example, if the following are true:
  • the line at time 0 = 1
  • the tab at time 0 = 0
  • statement at line 1, tab 0 = class Person:

then Control Map at time (0 + 1) = result of storing (pair ("class", "Person")) at key: 0 in map: (Control Map at time 0)

The new entry in the "Control" map stores the current tab as the key and the pair class:Person as the value. Try stepping through the simulator to see LW Python update the "Control" map.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments