[Tutor] Writing the Map function as a oneliner

2011-11-07 Thread Rafael Turner
Hello, I am trying to write the map function as a oneliner. I currently have implement map as a list comprehension: map = lambda F,li: [F(x) for x in li] But I would like to make recursive version. Here is what I was thinking: I can write map as def pyMap(F,li): if li == []: return

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 playi

[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: