[issue5669] Extra heap nlargest/nsmallest option for including ties

2009-04-02 Thread George Sakkis
George Sakkis added the comment: The second call should of course be: >>> for i in xrange(1,len(s)+1): print i,heapq.nsmallest(i,s,ties=True) -- ___ Python tracker ___ _

[issue5669] Extra heap nlargest/nsmallest option for including ties

2009-04-02 Thread George Sakkis
New submission from George Sakkis : It would be useful in many cases if heapq.nlargest and heapq.nsmallest grew an optional boolean parameter, say `ties` (defaulting to False) that when True, it would return more than `n` items if there are ties. To illustrate: >>> s = [4,3,5,7,4,7,4,3] >>> for