curious curious - 9 months ago 25
Python Question

How to call a function for every for iteration of a zip of two lists in Python

I have two lists:


I want for each
of those two to call a function, but not to do it in a trivial way inside a for loop. Is there a pythonic way? I tried with a

map(func(i,v) for i,v in zip(a,b))

but it does not work


If the function func doesn't return anything, you could use:

any(func(i, v) for i,v in zip(a, b))

Which will return False but not accumulate the results.