m3sh.heap.Heap.

top#

Heap.top#

Access top item.

The top item of a heap is defined to be the item with smallest key with respect to the < operator. Inspection of the top item does not change the heap.

Raises:
IndexError

When trying to access the top item of an empty heap.

See also

pop()

Notes

The data object of a heap item is accessible as item[0] or via tuple unpacking:

>>> obj, key = heap.top