Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
an example of concurrent.futures.ProcessPoolExecutor for python 2.7
import concurrent.futures
import time
def sleep_print_return(input):
print "{} started".format(input)
time.sleep(input % 3)
return input
def main():
# to observe the difference, change max_workers to 1
with concurrent.futures.ProcessPoolExecutor(max_workers=None) as executor:
for result in, range(25)):
# do stuff
print "{} finished".format(result)
if __name__ == '__main__':
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.