Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3.  
  4. import concurrent.futures
  5.  
  6.  
  7. def add(x):
  8.     s = 0
  9.     for e in x:
  10.         s += e
  11.     return s
  12.  
  13.  
  14. #with concurrent.futures.ProcessPoolExecutor() as e:
  15. with concurrent.futures.ThreadPoolExecutor() as e:
  16.     print(tuple(e.map(add, [[1, 2, 3], [1, 2], [3, 4]])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement