Guest User

Untitled

a guest
Apr 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. from multiprocessing import Pool
  2.  
  3. class Test(object):
  4. def __init__(self):
  5. self.array = []
  6.  
  7. def task(self, n):
  8. self.array.append(n)
  9. print(self.array)
  10.  
  11. def run(self):
  12. p = Pool(4)
  13. p.map(self.task, [1, 2, 3, 4])
  14.  
  15. Test().run()
Add Comment
Please, Sign In to add comment