summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/itertools.rst17
1 files changed, 10 insertions, 7 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 240baf0..4dfc083 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -200,20 +200,23 @@ loops that truncate the stream.
.. versionadded:: 2.7
-.. function:: count([n])
+.. function:: count(n=0, step=1)
- Make an iterator that returns consecutive integers starting with *n*. If not
- specified *n* defaults to zero. Often used as an argument to :func:`imap` to
- generate consecutive data points. Also, used with :func:`izip` to add sequence
- numbers. Equivalent to::
+ Make an iterator that returns evenly spaced values starting with *n*. Often
+ used as an argument to :func:`imap` to generate consecutive data points.
+ Also, used with :func:`izip` to add sequence numbers. Equivalent to::
- def count(n=0):
+ def count(n=0, step=1):
# count(10) --> 10 11 12 13 14 ...
+ # count(2.5, 0.5) -> 3.5 3.0 4.5 ...
while True:
yield n
- n += 1
+ n += step
+ .. versionchanged:: 2.7
+ added *step* argument and allowed non-integer arguments.
+
.. function:: cycle(iterable)
Make an iterator returning elements from the iterable and saving a copy of each.