[Tutor] map vs. list comprehension

Michael Broe mbroe at columbus.rr.com
Tue Feb 14 21:57:25 CET 2006


On Feb 14, 2006, at 3:46 PM, Andre Roberge wrote:

> [2**i for i in [1, 2, 3, 4]]

Ah yes, I'm sorry, I was thinking of the most general case, where the  
arguments are
two arbitrary lists. My example was too specific.

Is there a way to do something like the following in a list  
comprehension?

map(pow, [1, 7, 6, 2], [3, 8, 2, 5])

Mike



More information about the Tutor mailing list