Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- import time
- from multiprocessing.pool import Pool
- class Test:
- @classmethod
- def x(cls,y):
- time.sleep(y)
- print(f"{y}")
- def threaded_map(t):
- lmb, obj = t
- return lmb(obj)
- class Other:
- @classmethod
- def temp(cls):
- with Pool(3) as p:
- p.map(threaded_map, itertools.product([Test.x], [1.0, 5.5, 0.1, 0.2, 1.0]))
- Other.temp()
Add Comment
Please, Sign In to add comment