title: Python multithreading but using object instance
body: <p>I hope you can help me.</p>
  
  <p>I have a <code>msgList</code>, containing <code>msg</code> objects, each one having the <code>pos</code> and <code>content</code> attributes.
  Then I have a function <code>posClassify</code>, that creates a <code>SentimentClassifier</code> object, that iterates thru this <code>msgList</code> and does <code>msgList[i].pos = clf.predict(msgList[i].content)</code>, being <code>clf</code> an instance of <code>SentimentClassifier</code>.</p>
  
  <pre><code>def posClassify(msgList):
      clf = SentimentClassifier()
      for i in tqdm(range(len(msgList))):
          if msgList[i].content.find("omitted") == -1:
              msgList[i].pos = clf.predict(msgList[i].content)
  </code></pre>
  
  <p>And what I wanted is to compute this using multiprocessing. I have read that you create a pool, and call a function with a list of the arguments you want to pass this function, and thats it. I imagine that that function must be something like saving an image or working on different memory spaces, and not like mine, where you want to modify that same <code>msg</code> object, and also, having to use that <code>SentimentClassifier</code> object (which takes about 10 seconds or so to initialize).</p>
  
  <p>My thoughts where creating cpu_cores-1 processes, each one using an instance of <code>SentimentClassifier</code>, and then each process starts consuming that msg list with its own classifier, but I can't work out how to approach this. I also thought of creating threads with binary semaphores, each one calling its own classifier, and then waiting the semaphore to update the <code>pos</code> value in the <code>msg</code> object, but still cant figure it out.</p>