|
|
|
|
|
by kccqzy
127 days ago
|
|
It’s assigned left to right, not right to left. It’s documented in the Python language reference. > An assignment statement evaluates the expression list and assigns the single resulting object to each of the target lists, from left to right. Consider this: a = [1, 2]
i = a[i] = 1
If assignment were to happen right to left, you would get a NameError exception because the first assignment would require an unbound variable. |
|