[Python-checkins] python/dist/src/Lib heapq.py,1.24,1.25

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sun Jun 20 05:07:56 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18236/Lib

Modified Files:
	heapq.py 
Log Message:
Improve the documented advice on how to best use heapq.heapreplace().



Index: heapq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** heapq.py	13 Jun 2004 05:26:32 -0000	1.24
--- heapq.py	20 Jun 2004 09:07:52 -0000	1.25
***************
*** 155,159 ****
      more appropriate when using a fixed-size heap.  Note that the value
      returned may be larger than item!  That constrains reasonable uses of
!     this routine.
      """
      returnitem = heap[0]    # raises appropriate IndexError if heap is empty
--- 155,161 ----
      more appropriate when using a fixed-size heap.  Note that the value
      returned may be larger than item!  That constrains reasonable uses of
!     this routine unless written as part of a larger expression:
! 
!         result = item <= heap[0] and item  or  heapreplace(heap, item)
      """
      returnitem = heap[0]    # raises appropriate IndexError if heap is empty




More information about the Python-checkins mailing list