title: Multiplex on queue.Queue?
body: <p>How can I go about "selecting" on multiple <a href="http://docs.python.org/py3k/library/queue.html" rel="nofollow noreferrer"><code>queue.Queue</code></a>'s simultaneously?</p>
  
  <p>Golang has the <a href="http://golang.org/doc/go_spec.html#Select_statements" rel="nofollow noreferrer">desired feature</a> with its channels:</p>
  
  <pre><code>select {
  case i1 = &lt;-c1:
      print("received ", i1, " from c1\n")
  case c2 &lt;- i2:
      print("sent ", i2, " to c2\n")
  case i3, ok := (&lt;-c3):  // same as: i3, ok := &lt;-c3
      if ok {
          print("received ", i3, " from c3\n")
      } else {
          print("c3 is closed\n")
      }
  default:
      print("no communication\n")
  }
  </code></pre>
  
  <p>Wherein the first channel to unblock executes the corresponding block. How would I achieve this in Python?</p>
  
  <h2>Update0</h2>
  
  <p>Per <a href="http://www.1024cores.net/home/lock-free-algorithms/queues" rel="nofollow noreferrer">the link</a> given in <a href="https://stackoverflow.com/a/8539910/149482">tux21b's answer</a>, the desired queue type has the following properties:</p>
  
  <ul>
  <li>Multi-producer/multi-consumer queues (MPMC)</li>
  <li>provides per-producer FIFO/LIFO</li>
  <li>When a queue is empty/full consumers/producers get blocked</li>
  </ul>
  
  <p>Furthermore channels can be blocking, producers will block until a consumer retrieves the item. I'm not sure that Python's Queue can do this.</p>