[Python-checkins] bpo-39374: Updated sorting documentation (GH-18177)

Raymond Hettinger webhook-mailer at python.org
Sat Jan 25 17:19:10 EST 2020


https://github.com/python/cpython/commit/8271441d8b6e1f8eae1457c437da24e775801d9f
commit: 8271441d8b6e1f8eae1457c437da24e775801d9f
branch: master
author: Juhana Jauhiainen <juhana.jauhiainen at gmail.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2020-01-25T14:18:58-08:00
summary:

bpo-39374: Updated sorting documentation (GH-18177)

files:
M Doc/howto/sorting.rst

diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst
index 1d6d5c45b4d9f..a8efe65353d6e 100644
--- a/Doc/howto/sorting.rst
+++ b/Doc/howto/sorting.rst
@@ -43,16 +43,18 @@ Key Functions
 =============
 
 Both :meth:`list.sort` and :func:`sorted` have a *key* parameter to specify a
-function to be called on each list element prior to making comparisons.
+function (or other callable) to be called on each list element prior to making
+comparisons.
 
 For example, here's a case-insensitive string comparison:
 
     >>> sorted("This is a test string from Andrew".split(), key=str.lower)
     ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']
 
-The value of the *key* parameter should be a function that takes a single argument
-and returns a key to use for sorting purposes. This technique is fast because
-the key function is called exactly once for each input record.
+The value of the *key* parameter should be a function (or other callable) that
+takes a single argument and returns a key to use for sorting purposes. This
+technique is fast because the key function is called exactly once for each
+input record.
 
 A common pattern is to sort complex objects using some of the object's indices
 as keys. For example:



More information about the Python-checkins mailing list