In [1]:
from multiprocessing import Pool
from itertools import repeat

In [19]:
def f((x, y, z)):
    if x + y < 100:
        return x + y * z

In [20]:
inputs = zip(range(10000), repeat(6), reversed(range(10000)))

In [21]:
inputs[:10]


Out[21]:
[(0, 6, 9999),
 (1, 6, 9998),
 (2, 6, 9997),
 (3, 6, 9996),
 (4, 6, 9995),
 (5, 6, 9994),
 (6, 6, 9993),
 (7, 6, 9992),
 (8, 6, 9991),
 (9, 6, 9990)]

In [22]:
time a=map(f, inputs)


CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 2.43 ms

In [23]:
p = Pool(processes=4)

In [24]:
%%time
b = p.map(f, inputs)
p.close()


CPU times: user 4 ms, sys: 4 ms, total: 8 ms
Wall time: 7.71 ms

In [17]:
zip(range(10), repeat(2), range(10), [5,6])


Out[17]:
[(0, 2, 0, 5), (1, 2, 1, 6)]

In [ ]: