Simplifies Python assignment statement.
Before:
class A:
pass
a = b = c = A()
After:
class A:
pass
a = A()
b = a
c = b
The transformation has invariant id(a) == id(b) == id(c)
.
-
Traverse the AST and find the node which represents the assignment statement
-
Replace this node with the sequence of simple assignments.