[Python-checkins] r84822 - python/branches/py3k/Doc/library/functions.rst

raymond.hettinger python-checkins at python.org
Wed Sep 15 01:13:42 CEST 2010


Author: raymond.hettinger
Date: Wed Sep 15 01:13:42 2010
New Revision: 84822
Log:
Issue 9802: Document min()/max() sort stability
Modified:
 python/branches/py3k/Doc/library/functions.rst
Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst	(original)
+++ python/branches/py3k/Doc/library/functions.rst	Wed Sep 15 01:13:42 2010
@@ -634,6 +634,10 @@
 The optional keyword-only *key* argument specifies a one-argument ordering
 function like that used for :meth:`list.sort`.
 
+ If multiple items are maximal, the function returns the first one encountered.
+ This is consistent with other sort-stability preserving tools such as
+ ``sorted(iterable, key=keyfunc, reverse=True)[0]` and
+ ``heapq.nlargest(1, iterable, key=keyfunc)``.
 
 .. function:: memoryview(obj)
 :noindex:
@@ -651,6 +655,10 @@
 The optional keyword-only *key* argument specifies a one-argument ordering
 function like that used for :meth:`list.sort`.
 
+ If multiple items are minimal, the function returns the first one encountered.
+ This is consistent with other sort-stability preserving tools such as
+ ``sorted(iterable, key=keyfunc)[0]` and
+ ``heapq.nsmallest(1, iterable, key=keyfunc)``.
 
 .. function:: next(iterator[, default])
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /