[Tutor] mutable types

John washakie at gmail.com
Tue Nov 2 13:51:13 CET 2010


Hello, I thought the following should end with G[1] and G[0] returning
20. Why doesn't it?

In [69]: a = 10
In [70]: G = {}
In [71]: G[0] = [a]
In [72]: G[1] = G[0]
In [73]: a = 20
In [74]: G[1]
Out[74]: [10]
In [75]: G[0]
Out[75]: [10]

??


More information about the Tutor mailing list