I\'m trying to write Python expression evaluation visualizer, that will show how Python expressions are evaluated step by step (for education purposes). Philip Guo\'s Python
The addition of the two lists is certainly not the first node to be evaluated in that code; I believe there are in fact nine earlier node evaluations - sorted, 4, 2, 3, 1, [4,2,3,1], 5, 6, [5,6]. Not only would you have to determine what order evaluations are performed in, you'd also have to decide which of those evaluations are worth showing.
I think a better approach to your problem would be to modify the AST nodes so that they emit their before/after state as a side-effect of being executed. You wouldn't care about their order, you'd just execute the entire expression once. And there is already a package called macropy that has a tracing feature that does exactly this. Its output isn't quite what you're asking for, but it could probably be modified to be a closer match.