web3-starter-py/boilerplates/concurrency/pool_example.py
osiris account 69bb4175f1 💾
2023-03-12 15:29:57 -07:00

11 lines
No EOL
124 B
Python

#!/usr/bin/env python3
from multiprocessing import Pool
def f(x):
return x*x
p = Pool(5)
print(p.map(f, [1, 2, 3]))