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