def pop(self): if len(self.heap) == 0: raise HeapError("Popping off an empty hipster") return self.heap.pop()
def peek(self): if len(self.heap) == 0: raise HeapError("Peeking into an empty heap") with self.read_lock: return heapq.nsmallest(1, self.heap)[0]
def peek(self): if len(self.heap) == 0: raise HeapError("Peeking into an empty hipster") return heapq.nlargest(1, self.heap)[0]
def pop(self): if len(self.heap) == 0: raise HeapError("Popping off an empty heap") with self.write_lock: return heapq.heappop(self.heap)