original_docstring: Pop and return the current smallest value, and add the new item.
  
      This is more efficient than heappop() followed by heappush(), and can be
      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 conditional replacement:
  
          if item > heap[0]:
              item = heapreplace(heap, item)
      
docstring: Pop and return the current smallest value, and add the new item.
  This is more efficient than heappop() followed by heappush(), and can be
  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 conditional replacement.
  
  
docstring_tokens: Pop and return the current smallest value and add the new item . This is more efficient than heappop () followed by heappush () and can be 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 conditional replacement .
code: def heapreplace(heap, item):
      """Pop and return the current smallest value, and add the new item.
  
      This is more efficient than heappop() followed by heappush(), and can be
      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 conditional replacement:
  
          if item > heap[0]:
              item = heapreplace(heap, item)
      """
      returnitem = heap[0]    # raises appropriate IndexError if heap is empty
      heap[0] = item
      _siftup(heap, 0)
      return returnitem
code_tokens: def heapreplace ( heap , item ) : returnitem = heap [ 0 ] heap [ 0 ] = item _siftup ( heap , 0 ) return returnitem
short_docstring: Pop and return the current smallest value, and add the new item.
short_docstring_tokens: Pop and return the current smallest value and add the new item .
comment: """Pop and return the current smallest value, and add the new item.
  
      This is more efficient than heappop() followed by heappush(), and can be
      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 conditional replacement:
  
          if item > heap[0]:
              item = heapreplace(heap, item)
      """$SEP$# raises appropriate IndexError if heap is empty