[docs] [issue18646] Improve tutorial entry on 'Lambda Forms'.

Terry J. Reedy report at bugs.python.org
Sat Aug 3 22:42:06 CEST 2013

New submission from Terry J. Reedy:

[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')]

assignee: docs at python
components: Documentation
files: tut-lambda.diff
keywords: patch
messages: 194296
nosy: docs at python, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Improve tutorial entry on 'Lambda Forms'.
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31142/tut-lambda.diff

Python tracker <report at bugs.python.org>

More information about the docs mailing list