Re: [Tutor] List methods inside a dictionary of list

2011-07-11 Thread Rafael Turner
I did not understand the behavior of array multiplication. In fact, I just now learned what it was called thanks to your email. Best wishes, Rafael On Mon, Jul 11, 2011 at 9:33 AM, Brett Ritter wrote: > On Mon, Jul 11, 2011 at 9:26 AM, Rafael Turner > wrote: >> I am playing lists and dictionari

Re: [Tutor] List methods inside a dictionary of list

2011-07-11 Thread Brett Ritter
On Mon, Jul 11, 2011 at 9:26 AM, Rafael Turner wrote: > I am playing lists and dictionaries and I came across this > counter-intuitive result. > d = dict(zip(['a', 'q', 'c', 'b', 'e', 'd', 'g', 'j'],8*[[0]])) ... d['a'].__setitem__(0,4) ... > > I was not expecting all the keys to be upda

Re: [Tutor] List methods inside a dictionary of list

2011-07-11 Thread Walter Prins
Hi, On 11 July 2011 14:26, Rafael Turner wrote: > > >>> d = dict(zip(['a', 'q', 'c', 'b', 'e', 'd', 'g', 'j'],8*[[0]])) > >>>d > Out: > {'a': [0], > 'b': [0], > 'c': [0], > 'd': [0], > 'e': [0], > 'g': [0], > 'j': [0], > 'q': [0]} > > >>> d['a'].__setitem__(0,4) > >>> d > Out: > {'a': [4]

[Tutor] List methods inside a dictionary of list

2011-07-11 Thread Rafael Turner
Hello, I am playing lists and dictionaries and I came across this counter-intuitive result. >>> d = dict(zip(['a', 'q', 'c', 'b', 'e', 'd', 'g', 'j'],8*[[0]])) >>>d Out: {'a': [0], 'b': [0], 'c': [0], 'd': [0], 'e': [0], 'g': [0], 'j': [0], 'q': [0]} >>> d['a'].__setitem__(0,4) >>> d Out: