Re: [Tutor] mutable types

2010-11-02 Thread Steven D'Aprano
John wrote: 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] This doesn't actually have anything to do with

Re: [Tutor] mutable types

2010-11-02 Thread Knacktus
Am 02.11.2010 13:51, schrieb John: Hello, I thought the following should end with G[1] and G[0] returning 20. Why doesn't it? In [69]: a = 10 "a" is a reference to an immutable object of type int with value 10. Somewhere in memory is an object of type int with value 10 stored. This object cann