[docs] Suggestion for improving 4.7.5 Lambda Forms in Python tutorial

aseem bansal aseembansal at ymail.com
Tue Aug 20 20:08:57 CEST 2013


The tutorial about Lambda forms(Documentation->The Python Tutorial->4.7.5 Lambda Forms) currently assumes a prior knowledge of functional  programming paradigm. I wanted to propose a change to that. It can be made better by adding some common sense things to the explanation so the simple examples given don't overwhelm the first-time reader due to unfamiliarity with functional programming. The following could take care of the problem.
------------------
By popular demand, a few features commonly found in functional programming
languages like Lisp have been added to Python.  With the lambda keyword, small anonymous functions can be created. 

Here’s a function that
returns the sum of its two arguments: lambda a, b: a+b. Here the comma separated variables between the lambda and the colon are the function's arguments and the part after the colon is the return type of the anonymous function.

Lambda forms can be
used wherever function objects are required.  They are syntactically restricted
to a single expression.  Semantically, they are just syntactic sugar for a
normal function definition.  Like nested function definitions, lambda forms can
reference variables from the containing scope:

//The Code will be here.
------------------
Additionally adding the link to functional programming HowTO  in the first sentence "commonly found in functional programming
languages" can help the first-time reader and those unfamiliar with functional paradigm to get acquainted with functional programming in Python's context.

If someone reads it can someone send a reply to this about where this mailing list can be browsed. I sent a previous one also but wasn't able to follow through because I didn't know where to browse this mailing list.

 
Aseem Bansal
(aseembansal  at  ymail)
(asmbansal2 at gmail)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130820/e5a9099d/attachment-0001.html>


More information about the docs mailing list