title: Python threading in a loop but with max threads
body: <p>Right now I have a <code>for</code> loop that loops through a list, usually this list is 100-500 items long. In the <code>for</code> loop, a new thread is opened per item. So right now my code looks like this:</p>
  
  <pre><code>    threads = []
      for item in items:
          t = threading.Thread(target=myfunction, args=(item,))
          threads.append(t)
          t.start()
  </code></pre>
  
  <p>But I don't want to start a new thread per, seeing it only takes a few seconds MAX per thread to execute myfunction. I want to do my loop still, calling upon myfunction with each item in argument. But to close the thread once it's done, and allow another one to take over. The max number of threads I want to open is no less than 3, no more than 20. Although if it's easier, that range can vary. I just don't want to open up a new thread each item in the loop. </p>
  
  <p>For those that are curious, and if it matters. myfunction is a function that I defined that uses urllib to send a post request to a site. </p>
  
  <p>I'm new to python, but I'm not new to coding all together. Sorry for the noob question.</p>