summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-06-28 05:44:36 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-06-28 05:44:36 (GMT)
commit3567a876c7c86d443b3da18fb183ed677f260881 (patch)
tree1a1267de92e0d8f771652571d9d7282890c7a6f3 /Doc
parent5d2f515dd4735ab8bb69a8fd806b14ae9e361549 (diff)
downloadcpython-3567a876c7c86d443b3da18fb183ed677f260881.zip
cpython-3567a876c7c86d443b3da18fb183ed677f260881.tar.gz
cpython-3567a876c7c86d443b3da18fb183ed677f260881.tar.bz2
Add take() to examples. Tighten the islice() example
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libitertools.tex5
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/lib/libitertools.tex b/Doc/lib/libitertools.tex
index e146c6c..4f025e3 100644
--- a/Doc/lib/libitertools.tex
+++ b/Doc/lib/libitertools.tex
@@ -314,7 +314,7 @@ Check 1202 is for $823.14
>>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura',
'', 'martin', '', 'walter', '', 'samuele']
->>> for name in islice(reportlines, 3, len(reportlines), 2):
+>>> for name in islice(reportlines, 3, None, 2):
... print name.title()
...
Alex
@@ -380,4 +380,7 @@ from building blocks.
... result = result[1:] + (elem,)
... yield result
+>>> def take(n, seq):
+... return list(islice(seq, n))
+
\end{verbatim}