Feb. 19, 2003
4:15 p.m.
Your solution for itertools can work with map too:
def repeat(v,n): while n: yield v n-=1
map(f,L,repeat(K,len(L)))
The itertools combine together so you can do it all at C speed and not have to create your own ad-hoc generator: from itertools import repeat, islice map(f, L, islice(repeat(K),len(L))) Raymond Hettinger