Skip to content

Instantly share code, notes, and snippets.

@0atman 0atman/pmap.py
Last active Nov 9, 2017

Embed
What would you like to do?
A process-based pmap with sensible defaults, ready to go
from multiprocessing import Pool
def pmap(f, collection, size=10):
"""
Applies `f` in parallel over `collection`.
Pool `size` has a sensible default of 10.
"""
with Pool(size) as p:
return p.map(f, collection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.