a=[1,10]
b=[2,20]
h=[]
heapq.heappush(h,a)
heapq.heappush(h,b)
a[0]=5
heapq.heappop(h)
pops [5,10] instead of [2,20]
If I have used heapq.heapify(h) before popping up, it gives correct answer : i.e [2,20] Is it always required to heapify the list before popping in case you have changed any of the list values?