[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread George Sakkis
George Sakkis added the comment: Should have checked a recent version first; that's from 2.5 (r25:51908, Sep 19 2006, 09:52:17). Sorry for the noise. -- status: open -> closed ___ Python tracker ___

[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread DSM
DSM added the comment: I can't reproduce in current python, and the relevant lines now look like it = izip(iterable, count(0,-1))# decorate it = izip(imap(key, in1), count(0,-1), in2) # decorate It seems that these were fixed long ago by rhettinger

[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread George Sakkis
New submission from George Sakkis : According to the docs, heapq.nlargest should be equivalent to sorted(iterable, key=key, reverse=True)[:n], and since sorted() is stable, so should heapq.nlargest be. This is not the case: >>> s =[ ('Mike', -1), ('John', 3), ('George', 2), ('Adam', 3), ('P