title: Python multiprocessing queue.get with timeout vs sleep
body: <p>I can't find any documentation on python's queue get with timeout: get([block[, timeout]]) whereas there is good documentation on python's time.sleep() at <a href="http://www.pythoncentral.io/pythons-time-sleep-pause-wait-sleep-stop-your-code/" rel="nofollow">http://www.pythoncentral.io/pythons-time-sleep-pause-wait-sleep-stop-your-code/</a>. </p>
  
  <p>I've used the linux time to time a loop of 5, 500 and 5000 over both with a period of 100 ms and they both seem similar. </p>
  
  <p>Snippet 1: with queue timeout</p>
  
  <pre><code>while True:
      try:
          if self._queue.get(True,period) == '!STOP!: break
      except:
          # Queue.Empty session, keep going
          -- do stuff here --
  </code></pre>
  
  <p>Snippet 2: With time sleep</p>
  
  <pre><code>while True:
      try:
          if self._queue.get_nowait() == '!STOP!: break
      except:
          # Queue.Empty session, keep going
          -- do stuff here --
          time.sleep(period)
  </code></pre>
  
  <p>Snippet 1 is preferred because instead of sleeping, and then checking the poison pill queue, it 'sleeps' checking the queue. Of course it is a pretty moot point, since the period will normally only be between 0.100 and 0.500 secs but I wan't to make sure there isn't something in the queue.get that I'm missing.  </p>