【发布时间】:2021-08-15 06:00:21
【问题描述】:
有没有区别:
with Pool(...) as pool :
res = pool.imap_unordered(fun, iterator)
for val in res :
........
和..
with Pool(...) as pool :
for val in pool.imap_unordered(fun, iterator) :
........
是第二个变种更快!
【问题讨论】:
标签: python iterator multiprocessing pool