[pypy-svn] pypy default: Allow using kwargs with itertools.count.
alex_gaynor
commits-noreply at bitbucket.org
Fri Jan 21 01:04:17 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r41104:b4531697c1a9
Date: 2011-01-20 18:04 -0600
http://bitbucket.org/pypy/pypy/changeset/b4531697c1a9/
Log: Allow using kwargs with itertools.count.
diff --git a/pypy/module/itertools/test/test_itertools.py b/pypy/module/itertools/test/test_itertools.py
--- a/pypy/module/itertools/test/test_itertools.py
+++ b/pypy/module/itertools/test/test_itertools.py
@@ -50,6 +50,14 @@
it.next()
assert repr(it) == 'count(124)'
+ def test_count_kwargs(self):
+ import itertools
+
+ it = itertools.count(start=2, step=3)
+ assert it.next() == 2
+ assert it.next() == 5
+ assert it.next() == 8
+
def test_repeat(self):
import itertools
diff --git a/pypy/module/itertools/interp_itertools.py b/pypy/module/itertools/interp_itertools.py
--- a/pypy/module/itertools/interp_itertools.py
+++ b/pypy/module/itertools/interp_itertools.py
@@ -34,8 +34,8 @@
-def W_Count___new__(space, w_subtype, firstval=0, step=1):
- return space.wrap(W_Count(space, firstval, step))
+def W_Count___new__(space, w_subtype, start=0, step=1):
+ return space.wrap(W_Count(space, start, step))
W_Count.typedef = TypeDef(
'count',
More information about the Pypy-commit
mailing list