title: delete arbitrary item from heap in python
body: <p>Is there a binary heap implementation where I can pop other elements than the root in log n time?</p>
  
  <p>I use heapq - but <code>heap.index( wKeys )</code> in</p>
  
  <pre><code>heap.pop( heap.index( wKeys ) )
  </code></pre>
  
  <p>is very slow. I need a binary heap for my problem - where I sometime use</p>
  
  <pre><code>heapq.heappop(heap)
  </code></pre>
  
  <p>but also need to pop other elements than at the top from the heap. So a binary heap like heapq imlementation should do that but I havnt found a binary search method. I also looked at treap (<a href="http://stromberg.dnsalias.org/~strombrg/treap/" rel="nofollow noreferrer">http://stromberg.dnsalias.org/~strombrg/treap/</a>) and cannot find a method like this here either.</p>