This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mattheww
Recipients docs@python, mattheww
Date 2010-09-08.19:30:28
SpamBayes Score 1.9656478e-05
Marked as misclassified No
Message-id <1283974231.16.0.73129931792.issue9802@psf.upfronthosting.co.za>
In-reply-to
Content
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().
History
Date User Action Args
2010-09-08 19:30:31matthewwsetrecipients: + mattheww, docs@python
2010-09-08 19:30:31matthewwsetmessageid: <1283974231.16.0.73129931792.issue9802@psf.upfronthosting.co.za>
2010-09-08 19:30:29matthewwlinkissue9802 messages
2010-09-08 19:30:28matthewwcreate