A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-September/103553.html below:

[Python-Dev] Behaviour of max() and min() with equal keys

[Python-Dev] Behaviour of max() and min() with equal keysMatthew Woodcraft matthew at woodcraft.me.uk
Wed Sep 8 21:32:48 CEST 2010
Raymond Hettinger  <raymond.hettinger at gmail.com> wrote:

>Matthew Woodcraft wrote:
>> 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.

>> However, this isn't currently a documented guarantee. Could it be made
>> so? (As with the decision to declare sort() stable, it seems likely that
>> by now there's code out there relying on it anyway.)

> 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).

I've submitted issue 9802 as a feature request with a concrete suggestion for
the docs.

-M-

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4