[docs] Error in heapq documentation

Tristan Naumann tristan.naumann at gmail.com
Fri Aug 9 19:24:34 CEST 2013


The current heapq documentation states that:

- heapq.nlargest(n, iterable[, key]) is "Equivalent to: sorted(iterable,
key=key, reverse=True)[:n]"

- heapq.nsmallest(n, iterable[, key]) is "Equivalent to: sorted(iterable,
key=key)[:n]"

However, this does not hold true when n = None. Specifically, heapq throws
an exception while slicing appears to produce a shallow copy of the sorted
list.

Thanks!
--Tristan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130809/78fd3c23/attachment-0001.html>


More information about the docs mailing list