This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Improve tutorial entry on 'Lambda Forms'.
Type: enhancement Stage: patch review
Components: Documentation Versions: Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ezio.melotti, georg.brandl, python-dev, rhettinger, terry.reedy
Priority: normal Keywords: patch

Created on 2013-08-03 20:42 by terry.reedy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
tut-lambda.diff terry.reedy, 2013-08-03 20:42 review
Messages (5)
msg194296 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-08-03 20:42
[0. On mailing lists, 'lambda expression' is used rather than 'lambda form'. Docs use both. Consistency across docs is a broader issue than this one. So leave title alone for this one.]

1. (first sentence) "By popular demand, a few features commonly found in functional programming languages like Lisp have been added to Python." (in early Python 1!) I think this should just be deleted. See 4. below as a replacement.

2. " With the lambda keyword, small anonymous functions can be created."
Change to
"Small anonymous functions can be created with the lambda keyword."

3. change "Here’s a function that returns" to "This function returns"

3.5 add a sentence about the different between def and lambda (the name attribute.

4. Add sentences about the purposes of lambda. Add an example that illustrates passing functions. 

>>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
>>> pairs.sort(key=lambda pair: pair[1])
>>> pairs
[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
msg199042 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-06 08:22
New changeset d4eb47c3d681 by Georg Brandl in branch '2.7':
Closes #18646: improve lambda docs in tutorial.  Original patch by Terry Reedy.
msg199043 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-06 08:22
New changeset ef1a17d5e263 by Georg Brandl in branch '3.3':
Closes #18646: improve lambda docs in tutorial.  Original patch by Terry Reedy.
msg199045 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-06 08:25
Thanks for the patch; I modified it a little (removed the sentence about the name attribute; this is too involved for the tutorial, and used "lambda expression").  Will fix more "lambda form" in the docs in another changeset.
msg199051 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2013-10-06 08:35
I think this was a nice improvement.
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62846
2013-10-06 08:39:24georg.brandlsetstatus: open -> closed
resolution: fixed
2013-10-06 08:35:56rhettingersetnosy: + rhettinger
messages: + msg199051
2013-10-06 08:25:57georg.brandlsetstatus: closed -> open

nosy: + georg.brandl
messages: + msg199045

resolution: fixed -> (no value)
stage: resolved -> patch review
2013-10-06 08:22:25python-devsetmessages: + msg199043
2013-10-06 08:22:11python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg199042

resolution: fixed
stage: patch review -> resolved
2013-08-10 17:31:25ezio.melottisetnosy: + ezio.melotti
type: behavior -> enhancement
2013-08-03 20:42:06terry.reedycreate