def pushpop(self, item):
        'Equivalent to "heap.push(); return heap.popmin()" but more efficient.'
        if self and self[0] < item:
            return self.replace(item)
        return item
Equivalent to "heap.push(); return heap.popmin()" but more efficient.
recipes/Python/440673_Safe_heap_queue_class/recipe-440673.py