[docs] Improve tutorial entry on 'Lambda Forms'. (issue 18646)

ezio.melotti at gmail.com ezio.melotti at gmail.com
Sat Aug 10 19:31:15 CEST 2013

File Doc/tutorial/controlflow.rst (right):

Doc/tutorial/controlflow.rst:586: Lambda Forms
"forms" could be changed here as well.

Doc/tutorial/controlflow.rst:589: Small anonymous functions can be
created with the :keyword:`lambda` keyword.
I prefer "simple", rather than "small".

Doc/tutorial/controlflow.rst:590: This function returns the sum of its
two arguments: ``lambda a, b: a+b``.
"For example, this function..."?

Doc/tutorial/controlflow.rst:591: Lambda forms can be used wherever
function objects are required.  They are
I would get rid of "forms" here too.

Doc/tutorial/controlflow.rst:592: syntactically restricted to a single
expression.  Semantically, they are just
Do we have an explanation of what an "expression" is somewhere?

Doc/tutorial/controlflow.rst:594: name attribute will always be
'<lambda>'. Like nested function
Is this the only difference?  Maybe you could say:
"... a normal function definition, except that their name attribute will
always be '<lambda>'."
(Also there's a missing space after the period.)

Doc/tutorial/controlflow.rst:612: [(4, 'four'), (1, 'one'), (3,
'three'), (2, 'two')]
I think this example would make more sense if the elements of the tuples
were swapped.  A normal sort would sort them alphabetically, but with
the lambda you can sort the tuples correctly.
I would also put this example before the make_incrementor one, since
this usage is more common.


More information about the docs mailing list