3 ms·
"node" is initially blue, and then you do: node = node.next = red_node If assignments were right-to-left, the .next attribute would be set on the blue node.
by jwilk 8y ago
"node" is initially blue, and then you do:
node = node.next = red_node
If assignments were right-to-left, the .next attribute would be set on the blue node.
If they were left-to-right, it would be added to the red node.
The AttributeError exception shows it is the latter order.
- fractalb 8y agoIt doesn't say anything about the order of assignment. It just shows that `node.next` wasn't evaluated to anything. `node.next` needs to be evaluated before doing any assignments
- jjnoakes 8y agoSure it does. Write out the example with both orders of assignments (convert it to single assignments only) and run it both ways.