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

George Sakkis report at bugs.python.org
Thu Apr 2 21:07:54 CEST 2009


George Sakkis <george.sakkis at gmail.com> added the comment:

> That should have been:  last = result[-1]; [last]*s.count(last).

Nice, though that's not equivalent if the objects' identity is
significant for what happens next (which typically is the case when ties
are preserved). The sorted/bisect solution doesn't have this problem.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5669>
_______________________________________


More information about the Python-bugs-list mailing list