Message115892
In CPython, the builtin max() and min() have the property that if there are items with equal keys, the first item is returned. From a quick look at their source, I think this is true for Jython and IronPython too.
I propose making this a documented guarantee.
On Python-dev, Raymond Hettinger said:
<<
That seems like a reasonable request. This behavior has been around for a very long time is unlikely to change. Elsewhere, we've made efforts to document sort stability (i.e. sorted(), heapq.nlargest(), heapq.nsmallest, merge(), etc).
>>
(<http://mail.python.org/pipermail/python-dev/2010-September/103543.html>)
I'm attaching a patch with a concrete suggestion for a change to
functions.rst, modelled on the documentation of heapq.nlargest(). |
|
Date |
User |
Action |
Args |
2010-09-08 19:30:31 | mattheww | set | recipients:
+ mattheww, docs@python |
2010-09-08 19:30:31 | mattheww | set | messageid: <1283974231.16.0.73129931792.issue9802@psf.upfronthosting.co.za> |
2010-09-08 19:30:29 | mattheww | link | issue9802 messages |
2010-09-08 19:30:28 | mattheww | create | |
|