Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JessicaWachtel/fa85026e33c3efc9194afe8852995125 to your computer and use it in GitHub Desktop.
Save JessicaWachtel/fa85026e33c3efc9194afe8852995125 to your computer and use it in GitHub Desktop.
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
# threading
with ThreadPoolExecutor(max_workers=4) as executor:
results = executor.map(some_function, iterable)
# multiprocessing
with ProcessPoolExecutor(max_workers=4) as executor:
results = executor.map(some_function, iterable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment