Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b286591

Browse files
committed
Document that heappop() and heapreplace() raise IndexError if the heap
is empty.
1 parent 83dcf5a commit b286591

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Doc/lib/libheapq.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ \section{\module{heapq} ---
4545

4646
\begin{funcdesc}{heappop}{heap}
4747
Pop and return the smallest item from the \var{heap}, maintaining the
48-
heap invariant.
48+
heap invariant. If the heap is empty, \exception{IndexError} is raised.
4949
\end{funcdesc}
5050

5151
\begin{funcdesc}{heapify}{x}
@@ -55,6 +55,7 @@ \section{\module{heapq} ---
5555
\begin{funcdesc}{heapreplace}{heap, item}
5656
Pop and return the smallest item from the \var{heap}, and also push
5757
the new \var{item}. The heap size doesn't change.
58+
If the heap is empty, \exception{IndexError} is raised.
5859
This is more efficient than \function{heappop()} followed
5960
by \function{heappush()}, and can be more appropriate when using
6061
a fixed-size heap. Note that the value returned may be larger

0 commit comments

Comments
 (0)