Message91147
> Except that it's no longer true that "when n==1, it is
> more efficient to use the builtin min() and max() functions."
There's still the dispatch overhead.
If someone needs a n==1 case, they
*should* use min/max for both speed
and clarity.
Also, it is important the the docs
communicate the relationship between
min/max, nlargest/nsmallest, and sorted.
> It's right in the file you linked to. Search for "n * 10" in ...
That is in the pure python version of nsmallest() and that
code is not used (it is overriden by the C version). The
actual C implementation works differently -- it uses an
underlying maxheap so it can use a cleaner algorithm that
doesn't need switchover tricks.
If you feel like "kicking the ball around", please continue the
discussion on comp.lang.python -- I think we're done here. |
|
Date |
User |
Action |
Args |
2009-07-31 19:39:38 | rhettinger | set | recipients:
+ rhettinger, jab |
2009-07-31 19:39:38 | rhettinger | set | messageid: <1249069178.4.0.475994578957.issue6614@psf.upfronthosting.co.za> |
2009-07-31 19:39:37 | rhettinger | link | issue6614 messages |
2009-07-31 19:39:37 | rhettinger | create | |
|