summaryrefslogtreecommitdiffstats
path: root/Doc/ref5.tex
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-12-17 12:13:53 (GMT)
committerGuido van Rossum <guido@python.org>1993-12-17 12:13:53 (GMT)
commit3cbc16d9041fe1fa87356bdacc2f1ad52fb99a89 (patch)
tree75beb159dc2d0d9d19de7ea7352ae1afa48d8b17 /Doc/ref5.tex
parent67a5fdbcc2d86cda9ee2efb7a97cb458036d6927 (diff)
downloadcpython-3cbc16d9041fe1fa87356bdacc2f1ad52fb99a89.zip
cpython-3cbc16d9041fe1fa87356bdacc2f1ad52fb99a89.tar.gz
cpython-3cbc16d9041fe1fa87356bdacc2f1ad52fb99a89.tar.bz2
* lib2.tex (sys): updated sys.std{in,out,err} docs. Added
sys.tracebacklimit. * tut.tex (Exceptions): change text printed by traceback. * lib5.tex (audioop): added minmax. * lib5.tex (audioop.getsample): move wandered paragraph back * lib3.tex, partparse.py: undo mucking with \nopagebreak (didn't work). * partparse.py: ignore \nopagebreak command * ref5.tex: added description of lambda forms. * ref7.tex: added reference to lambda forms to section on function definition. * lib1.tex: removed lambda as built-in function (it is now a special form). Also removed feature of filter, map, reduce to turn a string argument into an anonymous function.
Diffstat (limited to 'Doc/ref5.tex')
-rw-r--r--Doc/ref5.tex16
1 files changed, 15 insertions, 1 deletions
diff --git a/Doc/ref5.tex b/Doc/ref5.tex
index 59ba90a..55f523f 100644
--- a/Doc/ref5.tex
+++ b/Doc/ref5.tex
@@ -604,10 +604,11 @@ object. $x ~\verb\is not\~ y$ yields the inverse truth value.
Boolean operations have the lowest priority of all Python operations:
\begin{verbatim}
-condition: or_test
+condition: or_test | lambda_form
or_test: and_test | or_test "or" and_test
and_test: not_test | and_test "and" not_test
not_test: comparison | "not" not_test
+lambda_form: "lambda" [parameter_list]: condition
\end{verbatim}
In the context of Boolean operations, and also when conditions are
@@ -638,6 +639,19 @@ invent a value anyway, it does not bother to return a value of the
same type as its argument, so e.g. \verb\not 'foo'\ yields \verb\0\,
not \verb\''\.)
+Lambda forms (lambda expressions) have the same syntactic position as
+conditions. They are a shorthand to create anonymous functions; the
+expression \verb\lambda\ {\em arguments}\verb\:\ {\em condition}
+yields a function object that behaves virtually identical to one
+defined with \verb\def\ {\em name}\verb\(\{\em arguments}\verb\) :
+return\ {\em condition}. See section \ref{function} for the syntax of
+parameter lists. Note that functions created with lambda forms cannot
+contain statements.
+\label{lambda}
+\indexii{lambda}{expression}
+\indexii{lambda}{form}
+\indexii{anonmymous}{function}
+
\section{Expression lists and condition lists}
\indexii{expression}{list}
\indexii{condition}{list}