summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libcollections.tex
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-04-21 15:47:16 (GMT)
committerGeorg Brandl <georg@python.org>2007-04-21 15:47:16 (GMT)
commita18af4e7a2091d11478754eb66ae387a85535763 (patch)
treefea8015d656cfee937bb6f3d106e6ca0e9f19d78 /Doc/lib/libcollections.tex
parent4d2adcca52ced412d4bdf131b872729c43520d58 (diff)
downloadcpython-a18af4e7a2091d11478754eb66ae387a85535763.zip
cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.gz
cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.bz2
PEP 3114: rename .next() to .__next__() and add next() builtin.
Diffstat (limited to 'Doc/lib/libcollections.tex')
-rw-r--r--Doc/lib/libcollections.tex6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/lib/libcollections.tex b/Doc/lib/libcollections.tex
index a763e31..5a07a2d 100644
--- a/Doc/lib/libcollections.tex
+++ b/Doc/lib/libcollections.tex
@@ -174,7 +174,7 @@ def roundrobin(*iterables):
while pending:
task = pending.popleft()
try:
- yield task.next()
+ yield next(task)
except StopIteration:
continue
pending.append(task)
@@ -315,12 +315,12 @@ letter.
The function \function{int()} which always returns zero is just a special
case of constant functions. A faster and more flexible way to create
-constant functions is to use \function{itertools.repeat()} which can supply
+constant functions is to use a lambda function which can supply
any constant value (not just zero):
\begin{verbatim}
>>> def constant_factory(value):
-... return itertools.repeat(value).next
+... return lambda: value
>>> d = defaultdict(constant_factory('<missing>'))
>>> d.update(name='John', action='ran')
>>> '%(name)s %(action)s to %(object)s' % d