This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jab
Recipients jab, rhettinger
Date 2009-07-31.18:18:44
SpamBayes Score 2.7670621e-09
Marked as misclassified No
Message-id <1249064326.74.0.280021684491.issue6614@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, that's great!

(I also noticed that the previously inutile line "_heappushpop = heappushpop" 
is now doing something in the heapq.py you linked to, nice.)

It looks like the docs haven't been updated yet though. For instance, 
http://docs.python.org/3.1/library/heapq.html still says "The latter two 
functions perform best for smaller values of n. For larger values, it is more 
efficient to use the sorted() function. Also, when n==1, it is more efficient 
to use the builtin min() and max() functions."

Also, I notice the pure Python implementation of nsmallest still does that 
check to see if n * 10 <= len(iterable), and if so uses an insort-based 
algorithm. It looks like this is still undocumented, inconsistent with the C 
implementation, and asymmetrical to the implementations of nlargest. If this 
branch is remaining there on purpose, I'd love see its existence mentioned and 
its theoretical basis explained in the docs, along with any similar branches 
implemented elsewhere in the code, if they should be.
History
Date User Action Args
2009-07-31 18:18:46jabsetrecipients: + jab, rhettinger
2009-07-31 18:18:46jabsetmessageid: <1249064326.74.0.280021684491.issue6614@psf.upfronthosting.co.za>
2009-07-31 18:18:44jablinkissue6614 messages
2009-07-31 18:18:44jabcreate