I have read this link recently here and it raises a question. The author only said about this
x = 23
y = x
But what about this
x = 23
y = 23
Is it still right that both x and y refer to one value 23 ? the first “23” is the same as the second “23” ? If it is then why I try this
a=[1,2,3]
b=[1,2,3]
b.reverse()
print(a)
The result is
[1, 2, 3]
Why is that? because both a and b refer to value [1,2,3] and list is a mutable type. As the author said "if two names refer to the same value, and the value is mutated, then both names see the change" In my code, b changed, why a didn't