In the following program, if a
is referring to the value in b
while b
is referring to the value 0
, then ultimately a
is dependent on the value that b
is referring to a = b
, right? So using this analogy if I change the value that b
is storing, then ultimately a
should refer to the same value as that of b
as well, but when I make these changes, I do not get the expected results that is the value in a
is unaffected, hence where am I misinterpreting then?
a = b = 0
print(a, b)
b = 1
print(a, b)
However if I re-write my program:
a = b = []
print(a, b)
b.append(1)
print(a, b)
Then we see that the value of a
significantly changes as b
is changed, Why?