Ordering in process pool python

Viewed 2727

I am trying to return the result from processes running in parallel in python. Here is the code .

from dateutil.parser import parse
from multiprocessing.dummy import Pool
from itertools import *
import time
import random

def abcd(a):
    time.sleep(a)
    print(a)
    return a

p = Pool(3)
a = p.starmap(abcd, zip([10, 2, 15]))
p.close()
p.join()
print(a)

Is the result always returned in the order of the array inside zip ?

2 Answers
Related