Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from multiprocess import Pool
- def fun(x):
- return fun1(x)
- def fun1(x):
- return x**2
- pool = Pool(4)
- pool.map(fun,[1,2,3,4])
- output:
- NameError: name 'fun1' is not defined
- from multiprocess import Pool
- def fun(x):
- print fun1(x)
- def fun1(x):
- return x**2
- if __name__ == '__main__':
- pool = Pool(4)
- pool.map(fun,[1,2,3,4])
Add Comment
Please, Sign In to add comment