title: How can I pass two arguments to Pool.starmap()?
body: <p>Originally, with the code I was using, Pool.map was sufficient for threading my code as there was only one argument (an, iterable) being passed in as a parameter to my function.  Now, I have a requirement to pass in multiple arguments to the function and I'm having some trouble using Pool.starmap.</p>
  
  <p>I attempted to use zip alongside Pool.map to no avail.</p>
  
  <p>Here's my current code:</p>
  
  <pre><code>def get_links_on_page(job_title, page_num):
      page = requests.get("%s/jobs?q=%s&amp;l=%s%%2C%s&amp;start=%s" % (__SITE_BASE__, job_title.replace(' ', '+'), 'City', 'PROV', str(page_num*25)), verify=False)
      print(page.url)
      soup = BeautifulSoup(page.content, 'html.parser')
  
      return [link.a.get('href') for link in soup.find_all('div', {'class': 'title'})]
  
  
  def get_all_links(job_title):
      """
      :param: job_title (string): A string representing the job's title
      """
  
      all_links = []
      pool = ThreadPool(processes=20)
      all_links.extend(pool.starmap(get_links_on_page, (job_title, [i for i in range(1, 5)]))) 
      pool.close()
      return all_links
  </code></pre>
  
  <p>This gives me an error like:</p>
  
  <pre><code>TypeError: '&lt;=' not supported between instances of 'list' and 'int'
  </code></pre>
  
  <p>I also attempted to pass in the two arguments as an iterable like so:</p>
  
  <pre><code>def get_all_links(job_title):
      all_links = []
      pool = ThreadPool(processes=20)
      all_links.extend(pool.starmap(get_links_on_page, [job_title, [i for i in range(1, 5)]])) #[func(job_title, 1), func(job_title, 2), func(job_title, 3) ...]
      pool.close()
      return all_links
  </code></pre>
  
  <p>And that would equate to 18 arguments and thus throw an error.
  I'm currently reading the docs here: </p>
  
  <p><a href="https://docs.python.org/dev/library/multiprocessing.html#multiprocessing.pool.Pool.starmap" rel="nofollow noreferrer">https://docs.python.org/dev/library/multiprocessing.html#multiprocessing.pool.Pool.starmap</a></p>
  
  <p>But I'm having trouble getting the syntax down..</p>
  
  <p>Any help would be really appreciated!</p>