我有一个我想要发情的发电机。
gen = requests.get(url, stream=True).iter_content(chunk_size=100)
我想平行地解决这个问题。
out = list(gen)
同步完成。
运行此:
from multiprocessing import Pool
out = Pool(10).imap((lambda x: x), gen)
给出错误:
raise value
cPickle.PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed