Skip to content

Instantly share code, notes, and snippets.

@sigmaris
Created May 12, 2014 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sigmaris/75b7088adae06cef20dc to your computer and use it in GitHub Desktop.
Save sigmaris/75b7088adae06cef20dc to your computer and use it in GitHub Desktop.
import gevent
import socket
threadpool = gevent.get_hub().threadpool # this is the default gevent threadpool
urls = ['www.google.com', 'www.example.com', 'www.python.org']
results = threadpool.map(socket.gethostbyname, urls)
# >>> results
# ['173.194.34.179', '93.184.216.119', '185.31.18.175']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment