]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-133881: add forward reference to `list.sort()` in lambda expression tutoria...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 17 May 2025 08:05:41 +0000 (10:05 +0200)
committerGitHub <noreply@github.com>
Sat, 17 May 2025 08:05:41 +0000 (08:05 +0000)
gh-133881: add forward reference to `list.sort()` in lambda expression tutorial (GH-133910)
(cherry picked from commit c1c9ad1d5a62a591eb2f0f0d29f3fa02e0949f14)

Co-authored-by: Oleg Burnaev <51371645+Shepard2154@users.noreply.github.com>
Doc/tutorial/controlflow.rst

index 8261bbdbfb7a018dfbf08462aacc3bd709603313..b8bc94e5218087273b1d29c253d3e5af52960a49 100644 (file)
@@ -998,7 +998,8 @@ scope::
    43
 
 The above example uses a lambda expression to return a function.  Another use
-is to pass a small function as an argument::
+is to pass a small function as an argument.  For instance, :meth:`list.sort`
+takes a sorting key function *key* which can be a lambda function::
 
    >>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
    >>> pairs.sort(key=lambda pair: pair[1])