Message91137
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. |
|
Date |
User |
Action |
Args |
2009-07-31 18:18:46 | jab | set | recipients:
+ jab, rhettinger |
2009-07-31 18:18:46 | jab | set | messageid: <1249064326.74.0.280021684491.issue6614@psf.upfronthosting.co.za> |
2009-07-31 18:18:44 | jab | link | issue6614 messages |
2009-07-31 18:18:44 | jab | create | |
|