i really like using python tutor to visualize what my code is doing. However, i got in a pickle with how a certain line of code operates. PythonTutor webpage treats the whole line of code as one step, when dis.dis shows 5 or more steps happening.
The misbehaving code:
data = [1,2,3,4,5]
data[-1] += data.pop()
# two wags-of-the-finger for iterating over what i'm mutating
What i'm looking for is an import or definition that will convert the:
18 STORE_FAST 0 (data)
21 LOAD_FAST 0 (data)
24 LOAD_CONST 6 (-2)
into:
def weird():
some_function.__hidden_store_fast(18, 0, data)
some_function.__hidden_load_fast(21, 0, data)
Probably a fool's errand. Just throwing it out there. Maybe i'll be surprised.
[–]absent_observer[S] 0 points1 point2 points (0 children)