title: how do I parallelize a simple python def with multiple argument
body: <p>I would like to parallelize a python script. I've create a definition:</p>
  
  <pre><code>def dummy(list1,list2):
    do usefull calculations ...
  </code></pre>
  
  <p>The list1 and list2 contain a list of files name that I should read and then make calculation with them. The files are independent. The list1 and 2 contain the same number of argument. </p>
  
  <p>Let us assume I have 2 cpus (I want to impose the number of cpus to be used). I would like the first cpu to call the definition with a list that contain only the first half of list1 and list2 and at the same time the second cpu should call the same def dummy with the second half of list1 and list2. </p>
  
  <p>Something like:</p>
  
  <pre><code>import multiprocessing
  nb_cpus = 2
  pool = multiprocessing.Pool(processes=nb_cpus)
  for ii in nb_cpus:
    list_half1 = list1[0:max/nb_cpus]
    list_half2 = list2[0:max/nb_cpus]
    result[ii] = pool.map(dummy,list_half1,list_half2)
  </code></pre>
  
  <p>The problem is that the pool.map can only work if the def has 1 argument and that I cannot loop over cpus.</p>
  
  <p>Thank you for any help on that problem !</p>
  
  <p>PS: It is not possible for me to concatenate the two arguments into one because in the real case I'm having I'm passing much more arguments. </p>