From c1c9ad1d5a62a591eb2f0f0d29f3fa02e0949f14 Mon Sep 17 00:00:00 2001 From: Oleg Burnaev <51371645+Shepard2154@users.noreply.github.com> Date: Sat, 17 May 2025 10:59:37 +0300 Subject: [PATCH] gh-133881: add forward reference to `list.sort()` in lambda expression tutorial (#133910) --- Doc/tutorial/controlflow.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 95939242fb7..9a810f16388 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -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])