[Patches] [ python-Patches-969791 ] Add nlargest() and nsmallest() to heapq.

SourceForge.net noreply at sourceforge.net
Wed Jun 9 15:00:16 EDT 2004


Patches item #969791, was opened at 2004-06-09 12:59
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=969791&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Tim Peters (tim_one)
>Summary: Add nlargest() and nsmallest() to heapq.

Initial Comment:
This patch adds a function that encapsulates a principal 
use case for heaps, finding the n largest from a dataset 
without doing a full sort.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-06-09 14:00

Message:
Logged In: YES 
user_id=80475

Revised the patch to also include nsmallest().

Note, the API intentionally does not provide default values of 
n.  This is to encourage use of min() and sorted() for corner 
cases.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=969791&group_id=5470



More information about the Patches mailing list