Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3cbc16d

Browse files
committed
* 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.
1 parent 67a5fdb commit 3cbc16d

7 files changed

Lines changed: 43 additions & 6 deletions

File tree

Doc/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ qua:
4141
latex qua
4242
dvips qua >qua.ps
4343

44-
lib.texi: lib1.tex lib2.tex lib3.tex lib4.tex lib5.tex texipre.dat texipost.dat
44+
lib.texi: lib1.tex lib2.tex lib3.tex lib4.tex lib5.tex \
45+
texipre.dat texipost.dat partparse.py
4546
python partparse.py -o @lib.texi lib[1-5].tex
4647
mv @lib.texi lib.texi
4748

4849
.PRECIOUS: lib.texi
4950

50-
python-lib.info: lib.texi
51+
python-lib.info: lib.texi fix.el
5152
emacs -batch -l fix.el -f save-buffer -kill
5253
makeinfo +footnote-style end +fill-column 72 +paragraph-indent 0 \
5354
lib.texi

Doc/ref/ref5.tex

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,11 @@ \section{Boolean operations} \label{Booleans}
604604
Boolean operations have the lowest priority of all Python operations:
605605

606606
\begin{verbatim}
607-
condition: or_test
607+
condition: or_test | lambda_form
608608
or_test: and_test | or_test "or" and_test
609609
and_test: not_test | and_test "and" not_test
610610
not_test: comparison | "not" not_test
611+
lambda_form: "lambda" [parameter_list]: condition
611612
\end{verbatim}
612613

613614
In the context of Boolean operations, and also when conditions are
@@ -638,6 +639,19 @@ \section{Boolean operations} \label{Booleans}
638639
same type as its argument, so e.g. \verb\not 'foo'\ yields \verb\0\,
639640
not \verb\''\.)
640641

642+
Lambda forms (lambda expressions) have the same syntactic position as
643+
conditions. They are a shorthand to create anonymous functions; the
644+
expression \verb\lambda\ {\em arguments}\verb\:\ {\em condition}
645+
yields a function object that behaves virtually identical to one
646+
defined with \verb\def\ {\em name}\verb\(\{\em arguments}\verb\) :
647+
return\ {\em condition}. See section \ref{function} for the syntax of
648+
parameter lists. Note that functions created with lambda forms cannot
649+
contain statements.
650+
\label{lambda}
651+
\indexii{lambda}{expression}
652+
\indexii{lambda}{form}
653+
\indexii{anonmymous}{function}
654+
641655
\section{Expression lists and condition lists}
642656
\indexii{expression}{list}
643657
\indexii{condition}{list}

Doc/ref/ref7.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ \section{Function definitions} \label{function}
292292
\indexii{parameter}{formal}
293293
\indexii{parameter}{actual}
294294

295+
It is also possible to create anonymous functions (functions not bound
296+
to a name), for immediate use in expressions. This uses lambda forms,
297+
described in section \ref{lambda}.
298+
295299
\begin{itemize}
296300

297301
\item

Doc/ref5.tex

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,11 @@ \section{Boolean operations} \label{Booleans}
604604
Boolean operations have the lowest priority of all Python operations:
605605

606606
\begin{verbatim}
607-
condition: or_test
607+
condition: or_test | lambda_form
608608
or_test: and_test | or_test "or" and_test
609609
and_test: not_test | and_test "and" not_test
610610
not_test: comparison | "not" not_test
611+
lambda_form: "lambda" [parameter_list]: condition
611612
\end{verbatim}
612613

613614
In the context of Boolean operations, and also when conditions are
@@ -638,6 +639,19 @@ \section{Boolean operations} \label{Booleans}
638639
same type as its argument, so e.g. \verb\not 'foo'\ yields \verb\0\,
639640
not \verb\''\.)
640641

642+
Lambda forms (lambda expressions) have the same syntactic position as
643+
conditions. They are a shorthand to create anonymous functions; the
644+
expression \verb\lambda\ {\em arguments}\verb\:\ {\em condition}
645+
yields a function object that behaves virtually identical to one
646+
defined with \verb\def\ {\em name}\verb\(\{\em arguments}\verb\) :
647+
return\ {\em condition}. See section \ref{function} for the syntax of
648+
parameter lists. Note that functions created with lambda forms cannot
649+
contain statements.
650+
\label{lambda}
651+
\indexii{lambda}{expression}
652+
\indexii{lambda}{form}
653+
\indexii{anonmymous}{function}
654+
641655
\section{Expression lists and condition lists}
642656
\indexii{expression}{list}
643657
\indexii{condition}{list}

Doc/ref7.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ \section{Function definitions} \label{function}
292292
\indexii{parameter}{formal}
293293
\indexii{parameter}{actual}
294294

295+
It is also possible to create anonymous functions (functions not bound
296+
to a name), for immediate use in expressions. This uses lambda forms,
297+
described in section \ref{lambda}.
298+
295299
\begin{itemize}
296300

297301
\item

Doc/tut.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ \section{Exceptions}
17601760

17611761
\bcode\small\begin{verbatim}
17621762
>>> 10 * (1/0)
1763-
Stack backtrace (innermost last):
1763+
Traceback (innermost last):
17641764
File "<stdin>", line 1
17651765
ZeroDivisionError: integer division or modulo
17661766
>>> 4 + foo*3

Doc/tut/tut.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ \section{Exceptions}
17601760

17611761
\bcode\small\begin{verbatim}
17621762
>>> 10 * (1/0)
1763-
Stack backtrace (innermost last):
1763+
Traceback (innermost last):
17641764
File "<stdin>", line 1
17651765
ZeroDivisionError: integer division or modulo
17661766
>>> 4 + foo*3

0 commit comments

Comments
 (0)