Do I totally misunderstand how python iterators are supposed to work or something?
from multiprocessing import Pool
from time import sleep
p = Pool(1)
data = range(5)#works as expected
#data = filter(lambda x: x%2==0,range(5))
#exits immediately if line above uncommented
results = p.imap(expensive_func, data)
for a, b in zip(data, results):
Why does this work as expected when 'data' is a range iterator, but when 'data' is a filtered iterator the loop exits after the first result is printed?