8000 gh-133881: add forward reference to `list.sort()` in lambda expressio… · python/cpython@c1c9ad1 · GitHub
[go: up one dir, main page]

Skip to content

Commit c1c9ad1

Browse files
authored
gh-133881: add forward reference to list.sort() in lambda expression tutorial (#133910)
1 parent faac627 commit c1c9ad1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/tutorial/controlflow.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,8 @@ scope::
999999
43
10001000

10011001
The above example uses a lambda expression to return a function. Another use
1002-
is to pass a small function as an argument::
1002+
is to pass a small function as an argument. For instance, :meth:`list.sort`
1003+
takes a sorting key function *key* which can be a lambda function::
10031004

10041005
>>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
10051006
>>> pairs.sort(key=lambda pair: pair[1])

0 commit comments

Comments
 (0)
0