]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* lib2.tex (sys): updated sys.std{in,out,err} docs. Added
authorGuido van Rossum <guido@python.org>
Fri, 17 Dec 1993 12:13:53 +0000 (12:13 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 17 Dec 1993 12:13:53 +0000 (12:13 +0000)
  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.

Doc/Makefile
Doc/ref/ref5.tex
Doc/ref/ref7.tex
Doc/ref5.tex
Doc/ref7.tex
Doc/tut.tex
Doc/tut/tut.tex

index f4a747d8b402499a2b2410f3ff6a51d8a8f15ade..d13f59fa7c44722c8ea48611d774c466d935c752 100644 (file)
@@ -41,13 +41,14 @@ qua:
        latex qua
        dvips qua >qua.ps
 
-lib.texi: lib1.tex lib2.tex lib3.tex lib4.tex lib5.tex texipre.dat texipost.dat
+lib.texi: lib1.tex lib2.tex lib3.tex lib4.tex lib5.tex \
+       texipre.dat texipost.dat partparse.py
        python partparse.py -o @lib.texi lib[1-5].tex
        mv @lib.texi lib.texi
 
 .PRECIOUS:     lib.texi
 
-python-lib.info: lib.texi
+python-lib.info: lib.texi fix.el
        emacs -batch -l fix.el -f save-buffer -kill
        makeinfo +footnote-style end +fill-column 72 +paragraph-indent 0 \
                 lib.texi
index 59ba90a4d8e08036f232b3ea4c6b9d0d8cf90f69..55f523fb172ae9c067fb406ae146b74cc72e11f7 100644 (file)
@@ -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}
index 0f96c82788d368ee798ae8d0b024d0bee20be6b9..670eec0a5e68480361edfae18c08f246bcf68666 100644 (file)
@@ -292,6 +292,10 @@ parameters) are bound to the (formal) parameters, as follows:
 \indexii{parameter}{formal}
 \indexii{parameter}{actual}
 
+It is also possible to create anonymous functions (functions not bound
+to a name), for immediate use in expressions.  This uses lambda forms,
+described in section \ref{lambda}.
+
 \begin{itemize}
 
 \item
index 59ba90a4d8e08036f232b3ea4c6b9d0d8cf90f69..55f523fb172ae9c067fb406ae146b74cc72e11f7 100644 (file)
@@ -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}
index 0f96c82788d368ee798ae8d0b024d0bee20be6b9..670eec0a5e68480361edfae18c08f246bcf68666 100644 (file)
@@ -292,6 +292,10 @@ parameters) are bound to the (formal) parameters, as follows:
 \indexii{parameter}{formal}
 \indexii{parameter}{actual}
 
+It is also possible to create anonymous functions (functions not bound
+to a name), for immediate use in expressions.  This uses lambda forms,
+described in section \ref{lambda}.
+
 \begin{itemize}
 
 \item
index 6fb209f9f7ad464a4442e79a55d207a61ca7d637..532748876a7646f1c50b0f1edd3151f053f7a919 100644 (file)
@@ -1760,7 +1760,7 @@ however, and result in error messages as shown here:
 
 \bcode\small\begin{verbatim}
 >>> 10 * (1/0)
-Stack backtrace (innermost last):
+Traceback (innermost last):
   File "<stdin>", line 1
 ZeroDivisionError: integer division or modulo
 >>> 4 + foo*3
index 6fb209f9f7ad464a4442e79a55d207a61ca7d637..532748876a7646f1c50b0f1edd3151f053f7a919 100644 (file)
@@ -1760,7 +1760,7 @@ however, and result in error messages as shown here:
 
 \bcode\small\begin{verbatim}
 >>> 10 * (1/0)
-Stack backtrace (innermost last):
+Traceback (innermost last):
   File "<stdin>", line 1
 ZeroDivisionError: integer division or modulo
 >>> 4 + foo*3