Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c113465a
Commit
c113465a
authored
Nov 27, 2000
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF non-bug 123520: fleshed out the tutorial's lambda example a little more.
parent
cb54be86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
Doc/tut/tut.tex
Doc/tut/tut.tex
+9
-2
No files found.
Doc/tut/tut.tex
View file @
c113465a
...
...
@@ -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}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment