A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-June/045425.html below:

[Python-Dev] Re: heapq API

[Python-Dev] Re: heapq API [Python-Dev] Re: heapq APIScott David Daniels Scott.Daniels at Acm.Org
Wed Jun 16 13:22:31 EDT 2004
Raymond Hettinger wrote:
> def heappushpop(heap, item):
>     “Pushes the item onto the heap and then pops the smallest value”
> 
>     if not heap or item < heap[0]:
>         return item
>     return heapreplace(heap, item)
Better is:
      if heap and heap[0] < item:
          return heapreplace(heap, item)
      return item
-- Don't touch the heap unless necessary.

-- 
-- Scott David Daniels
Scott.Daniels at Acm.Org


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4