Guest User

Untitled

a guest
Jan 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. from multiprocess import Pool
  2.  
  3.  
  4. def fun(x):
  5. return fun1(x)
  6.  
  7. def fun1(x):
  8. return x**2
  9.  
  10. pool = Pool(4)
  11.  
  12. pool.map(fun,[1,2,3,4])
  13.  
  14.  
  15. output:
  16.  
  17. NameError: name 'fun1' is not defined
  18.  
  19. from multiprocess import Pool
  20. def fun(x):
  21. print fun1(x)
  22.  
  23. def fun1(x):
  24. return x**2
  25.  
  26. if __name__ == '__main__':
  27. pool = Pool(4)
  28. pool.map(fun,[1,2,3,4])
Add Comment
Please, Sign In to add comment