什么堆弹出returns?

what heap pop returns?

我对堆弹出输出感到困惑。

import heapq
heapq.heappush(PQ, ['b', 0.95])
heapq.heappush(PQ, ['d', 0.72])
heapq.heappush(PQ, ['e', 1.75])

a = heapq.heappop(PQ)
print (a)

它 returns : ['b', 0.95] 为什么它不返回 ['d', 0.72]

import heapq
PQ = []
heapq.heappush(PQ, ['z', 0.95]) # Changed it to z which is bigger 
heapq.heappush(PQ, ['d', 0.72])
heapq.heappush(PQ, ['e', 1.75])

a = heapq.heappop(PQ)
print (a)

结果为['d', 0.72]。第一个元素用于排序 min-heap.