Given an array
nums=[3,2,1,0]
when I run this code:
i=0
nums[i],i=None,nums[i]
print(i,nums)
>>>3 [None, 2, 1, 0]
But when I change the order of value assignment
i=0
i,nums[i]=nums[i],None
print(i,nums)
>>>3 [3, 2, 1, None]
This makes me feel confused because I think the assignment happens simultaneously
Here, in my first code snippet, it runs as expected, nums[i] is set to None and i is set to old nums[i]at the same time
But in the second code snippet, it seems that i is set to 3 first, and then nums[3] is set to None.