Guest User

Untitled

a guest
Feb 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import itertools
  2. import time
  3. from multiprocessing.pool import Pool
  4.  
  5.  
  6. class Test:
  7. @classmethod
  8. def x(cls,y):
  9. time.sleep(y)
  10. print(f"{y}")
  11.  
  12. def threaded_map(t):
  13. lmb, obj = t
  14. return lmb(obj)
  15.  
  16. class Other:
  17. @classmethod
  18. def temp(cls):
  19. with Pool(3) as p:
  20. p.map(threaded_map, itertools.product([Test.x], [1.0, 5.5, 0.1, 0.2, 1.0]))
  21.  
  22. Other.temp()
Add Comment
Please, Sign In to add comment