Sakesun
Posts: 10
Nickname: sakesun
Registered: Aug, 2003
|
|
Re: The fate of reduce() in Python 3000
|
Posted: Apr 24, 2005 7:28 PM
|
|
> Also, how do you cleanly achieve lists that are a function > of multiple sequences with list comprehensions? How do > you do this, for example: > > >>> map(lambda x, y: (x, y, x*y), range(6), range(6)) > [(0, 0, 0), (1, 1, 1), (2, 2, 4), (3, 3, 9), (4, 4, 16), > (5, 5, 25)] >
Would this work ?
>>> [(x, y, x*y) for x,y in itertools.izip(range(6), range(6))]
BTW, I don't want to loose lambda, map, and filter.
|
|