A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Re: heapq API

[Python-Dev] Re: heapq API [Python-Dev] Re: heapq APIScott David Daniels daniels at db-x.com
Thu Jun 17 20:28:38 EDT 2004
Josiah Carlson wrote:
> Scott David Daniels wrote:
>>Better is:
>>      if heap and heap[0] < item:
>>          return heapreplace(heap, item)
>>      return item
> 
> The or method short-circuits too.
> 
>>>>heap = []
>>>>not heap or 7 < heap[0]

Ah, but the point was to avoid the heapreplace
call on equal values, not to get the shortcircuiting.
Since < is the primitive-of-choice, I reversed the test.

-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