Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:
> 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6614> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com