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

Skip to content

Commit c113465

Browse files
committed
SF non-bug 123520: fleshed out the tutorial's lambda example a little more.
1 parent cb54be8 commit c113465

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Doc/tut/tut.tex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,8 +1497,15 @@ \subsection{Lambda Forms \label{lambda}}
14971497
overcome through the judicious use of default argument values, e.g.
14981498

14991499
\begin{verbatim}
1500-
def make_incrementor(n):
1501-
return lambda x, incr=n: x+incr
1500+
>>> def make_incrementor(n):
1501+
... return lambda x, incr=n: x+incr
1502+
...
1503+
>>> f = make_incrementor(42)
1504+
>>> f(0)
1505+
42
1506+
>>> f(1)
1507+
43
1508+
>>>
15021509
\end{verbatim}
15031510

15041511

0 commit comments

Comments
 (0)