[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread George Sakkis
New submission from George Sakkis george.sak...@gmail.com: 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',

[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5697 ___ ___

[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread DSM
DSM dsm...@users.sourceforge.net 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

[issue5697] heapq.nlargest does not perform stable sort

2009-04-05 Thread George Sakkis
George Sakkis george.sak...@gmail.com 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 rep...@bugs.python.org