summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-10-15 12:19:22 -0700
committerBrian Curtin <brian@python.org>2018-10-15 13:19:22 -0600
commit407f3dd69192ee8614faf1f9a484045a39174c74 (patch)
treeea8a7f41fd2526a470d254d172daef38d8284def
parent08ba7eb89d5353af31ef9e66a5337abea1b676ef (diff)
downloadcpython-git-407f3dd69192ee8614faf1f9a484045a39174c74.tar.gz
fix dangling keyfunc examples in documentation of heapq and sorted (GH-1432)
* fix dangling mention of key=str.lower in heapq doc * Fix dangling mention of keyfunc example for sorted() (cherry picked from commit 6bdb6f7675922e601e742758c7c240a751fd365b) Co-authored-by: Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
-rw-r--r--Doc/library/functions.rst4
-rw-r--r--Doc/library/heapq.rst10
2 files changed, 7 insertions, 7 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index b6e52469bd..bc528dd171 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1383,8 +1383,8 @@ are always available. They are listed here in alphabetical order.
Has two optional arguments which must be specified as keyword arguments.
*key* specifies a function of one argument that is used to extract a comparison
- key from each list element: ``key=str.lower``. The default value is ``None``
- (compare the elements directly).
+ key from each element in *iterable* (for example, ``key=str.lower``). The
+ default value is ``None`` (compare the elements directly).
*reverse* is a boolean value. If set to ``True``, then the list elements are
sorted as if each comparison were reversed.
diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst
index 7e33e74814..d04033b1ff 100644
--- a/Doc/library/heapq.rst
+++ b/Doc/library/heapq.rst
@@ -110,17 +110,17 @@ The module also offers three general purpose functions based on heaps.
Return a list with the *n* largest elements from the dataset defined by
*iterable*. *key*, if provided, specifies a function of one argument that is
- used to extract a comparison key from each element in the iterable:
- ``key=str.lower`` Equivalent to: ``sorted(iterable, key=key,
- reverse=True)[:n]``
+ used to extract a comparison key from each element in *iterable* (for example,
+ ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key,
+ reverse=True)[:n]``.
.. function:: nsmallest(n, iterable, key=None)
Return a list with the *n* smallest elements from the dataset defined by
*iterable*. *key*, if provided, specifies a function of one argument that is
- used to extract a comparison key from each element in the iterable:
- ``key=str.lower`` Equivalent to: ``sorted(iterable, key=key)[:n]``
+ used to extract a comparison key from each element in *iterable* (for example,
+ ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:n]``.
The latter two functions perform best for smaller values of *n*. For larger