summaryrefslogtreecommitdiffstats
path: root/Doc/library/itertools.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-22 23:25:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-01-22 23:25:35 (GMT)
commit1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce (patch)
tree365fcd0e0d95e4ff612ca7184d441e6184f8b203 /Doc/library/itertools.rst
parent86def6cb2b8d6d8c7f239795fa7af57c97a5890d (diff)
downloadcpython-1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce.zip
cpython-1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce.tar.gz
cpython-1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce.tar.bz2
Replace map(None, *iterables) with zip(*iterables).
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r--Doc/library/itertools.rst16
1 files changed, 4 insertions, 12 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index ca2b1ff..1b5ff81 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -204,21 +204,13 @@ loops that truncate the stream.
.. function:: imap(function, *iterables)
Make an iterator that computes the function using arguments from each of the
- iterables. If *function* is set to ``None``, then :func:`imap` returns the
- arguments as a tuple. Like :func:`map` but stops when the shortest iterable is
- exhausted instead of filling in ``None`` for shorter iterables. The reason for
- the difference is that infinite iterator arguments are typically an error for
- :func:`map` (because the output is fully evaluated) but represent a common and
- useful way of supplying arguments to :func:`imap`. Equivalent to::
+ iterables. Equivalent to::
def imap(function, *iterables):
- iterables = map(iter, iterables)
+ iterables = [iter(it) for it in iterables)
while True:
- args = [next(i) for i in iterables]
- if function is None:
- yield tuple(args)
- else:
- yield function(*args)
+ args = [next(it) for it in iterables]
+ yield function(*args)
.. function:: islice(iterable, [start,] stop [, step])