def _replace(self, h, elt):
"""
insert/replace an element
- h: a hash value
- elt: an object as returned by the method `make_elt()`
"""
heapset = self._heapset
heapset.add(h)
out = heapreplace(self._heap, elt)
heapset.remove(self._extracthash(out))
return out
评论列表
文章目录