In Python, a is a name - it points to an object, in this case a list.
In the first example, a first points to an empty list, and then to a new list.
In your second example, a points to an empty list, then it is updated to contain values ββfrom the new list. This does not change the list of a links.
The difference in the final result is that, since the right-hand side of the operation is first evaluated, in both cases a points to the original list. This means that in the first case, it points to a list that was previously a , and in the second case, it points to itself, creating a recursive structure.
If you have trouble understanding this, I recommend taking a look at which he visualized .
source share