summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tut/tut.tex11
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index ae835cd..87c7a9a 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -1497,8 +1497,15 @@ cannot reference variables from the containing scope, but this can be
overcome through the judicious use of default argument values, e.g.
\begin{verbatim}
-def make_incrementor(n):
- return lambda x, incr=n: x+incr
+>>> def make_incrementor(n):
+... return lambda x, incr=n: x+incr
+...
+>>> f = make_incrementor(42)
+>>> f(0)
+42
+>>> f(1)
+43
+>>>
\end{verbatim}