title: Python: delete element from heap
body: <p>Python has <code>heapq</code> module which implements heap data structure and it supports some basic operations (push, pop).</p>
  
  <p>How to remove i-th element from the heap in O(log n)? Is it even possible with <code>heapq</code> or do I have to use another module?</p>
  
  <p>Note, there is an example at the bottom of the documentation:
  <a href="http://docs.python.org/library/heapq.html" rel="noreferrer">http://docs.python.org/library/heapq.html</a>
  which suggest a possible approach - this is not what I want. I want the element to remove, not to merely mark as removed.</p>