Message236895
The heapq documentation has this paragraph after the doc of nsmallest:
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 built-in min() and max() functions.
This is confusing as it suggests to use min() on a heap to find the minimal element.
heap[0] is the minimal element, but this is only mentioned at the very top - so you need to read the doc of the entire module to find it. Nothing in the docs of methods suggests it. |
|
Date |
User |
Action |
Args |
2015-02-28 16:37:41 | eli.bendersky | set | recipients:
+ eli.bendersky, docs@python |
2015-02-28 16:37:41 | eli.bendersky | set | messageid: <1425141461.42.0.47354110207.issue23549@psf.upfronthosting.co.za> |
2015-02-28 16:37:41 | eli.bendersky | link | issue23549 messages |
2015-02-28 16:37:41 | eli.bendersky | create | |
|