python gevent使用例子

python gevent使用例子

from gevent.pool import Pool

POOL_SIZE = 100

def process(func, param1_list, param2_list)
stat = {}
pool = Pool(POOL_SIZE)
results = pool.imap_unordered(func, param1_list, param2_list)
pool.join()
# 处理结果
for value in results:
stat.update(value)
return stat def add(a, b):
return {a: a+b} print(process(add, [1,2,3], [3,4,5]))
# {1: 4, 2: 6, 3: 8}
上一篇:Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier解决办法


下一篇:OSGI target环境配置过程