summaryrefslogtreecommitdiffstats
path: root/Doc/library/itertools.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-17 03:02:14 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-01-17 03:02:14 (GMT)
commit473170908e11e347aca4adf23738a82162b981e3 (patch)
tree2fa25a5ccd4abfc71e6a0f5193838a726ce4c68a /Doc/library/itertools.rst
parent3ad2acc8575e1977cece844b17c572550503a615 (diff)
downloadcpython-473170908e11e347aca4adf23738a82162b981e3.zip
cpython-473170908e11e347aca4adf23738a82162b981e3.tar.gz
cpython-473170908e11e347aca4adf23738a82162b981e3.tar.bz2
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r--Doc/library/itertools.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 788d931..e797aab 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -330,17 +330,19 @@ loops that truncate the stream.
.. function:: starmap(function, iterable)
- Make an iterator that computes the function using arguments tuples obtained from
+ Make an iterator that computes the function using arguments obtained from
the iterable. Used instead of :func:`imap` when argument parameters are already
grouped in tuples from a single iterable (the data has been "pre-zipped"). The
difference between :func:`imap` and :func:`starmap` parallels the distinction
between ``function(a,b)`` and ``function(*c)``. Equivalent to::
def starmap(function, iterable):
- iterable = iter(iterable)
- while True:
- yield function(*iterable.next())
+ for args in iterable:
+ yield function(*args)
+ .. versionchanged:: 2.6
+ Previously, :func:`starmap` required the function arguments to be tuples.
+ Now, any iterable is allowed.
.. function:: takewhile(predicate, iterable)