fork(3) download
  1. from multiprocessing import Pool
  2.  
  3. def fib(n):
  4. if n <= 1:
  5. return n
  6. else:
  7. return(fib(n-1) + fib(n-2))
  8.  
  9. try:
  10. p = Pool()
  11. print (p.map(fib, [10, 15, 20]))
  12. finally:
  13. p.close()
Success #stdin #stdout 0.04s 40320KB
stdin
Standard input is empty
stdout
[55, 610, 6765]