def pop(self): _, smallest = heapq.heappop(self.heap) self._remove_from_dict(smallest) return smallest