ここでxを更新しています。xを更新した後にyを印刷すると、yに反射が表示されます。ただし、最初の例では、yはその変化を示していません。これは私が迷子になるところです。誰かが私にこれを説明できますか?
x = 2
y = x + 3
### printing y will yield 5
x = 8 # ok am I updating the same storage space that x pointed to, or is abandoning it and creating
# another with a value of 8?
### printing y will still yield 5 (why is that? if Y always points to x and adds 3 to it?)
in contrast with this:
x = [1,2,3]
y = [x,4,5,6]
x[0] = 50
y[2] = 80
z = y[:] + [100,101,1020