8000 [3.13] gh-133881: add forward reference to `list.sort()` in lambda expression tutorial (GH-133910) by miss-islington · Pull Request #134127 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-133881: add forward reference to list.sort() in lambda expression tutorial (GH-133910) #134127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-133881: add forward reference to list.sort() in lambda expressio…
…n tutorial (GH-133910)

(cherry picked from commit c1c9ad1)

Co-authored-by: Oleg Burnaev <51371645+Shepard2154@users.noreply.github.com>
  • Loading branch information
Shepard2154 authored and miss-islington committed May 17, 2025
commit d95e663185c3554afcb9cd58130a024c215b75d3
3 changes: 2 additions & 1 deletion Doc/tutorial/controlflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
Loading
0