Skip to content

Instantly share code, notes, and snippets.

@gr33ndata
Created January 18, 2014 07:58
Show Gist options
  • Select an option

  • Save gr33ndata/8487613 to your computer and use it in GitHub Desktop.

Select an option

Save gr33ndata/8487613 to your computer and use it in GitHub Desktop.
Python Multiprocessing using Pool.map
from time import sleep
from multiprocessing import Pool
def fun(i):
if i % 2:
sleep(2)
print i
pool = Pool(4)
pool.map(fun,range(40))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment