From: Paul Prescod Date: 2002-11-15T07:51:43+09:00 Subject: Re: Ruby equivalent to Python's map()? Roberto Amorim wrote: > Hi... > >... > However, I was messing around yesterday with Ruby and looked > everywhere for some functionality close to the map() function on > python, but couldn't find it anywhere. For those that don't know the > function, here's a raw example: > > a = [1,2,3] > b = [4,5,6] > map(None, a, b) --> [[1,4],[2,5],[3,6]] The better way to do this in Python is with "zip". map() is better for applying a function to one or more lists. If zip had been invented when map was invented, map probably wouldn't even have this map(None) feature. Paul Prescod