]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133881: add forward reference to `list.sort()` in lambda expression tutorial ...
authorOleg Burnaev <51371645+Shepard2154@users.noreply.github.com>
Sat, 17 May 2025 07:59:37 +0000 (10:59 +0300)
committerGitHub <noreply@github.com>
Sat, 17 May 2025 07:59:37 +0000 (09:59 +0200)
Doc/tutorial/controlflow.rst

index 95939242fb7d44c489cb3d067a2867e8aed9c0f3..9a810f16388b9d5f677d8469f9c7e8f4c2ec8e60 100644 (file)
@@ -999,7 +999,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])