[Python-checkins] cpython (3.3): Issue 17862: Improve the signature of itertools grouper() recipe.

raymond.hettinger python-checkins at python.org
Mon May 6 04:54:34 CEST 2013


http://hg.python.org/cpython/rev/6383d0c8140d
changeset:   83633:6383d0c8140d
branch:      3.3
parent:      83625:c8cdc2400643
user:        Raymond Hettinger <python at rcn.com>
date:        Sun May 05 19:53:41 2013 -0700
summary:
  Issue 17862:  Improve the signature of itertools grouper() recipe.

Putting *n* after the *iterable* matches the signature of other itertools
and recipes.  Also, it reads better.

Suggested by Ezio Melotti.

files:
  Doc/library/itertools.rst |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -705,9 +705,9 @@
        next(b, None)
        return zip(a, b)
 
-   def grouper(n, iterable, fillvalue=None):
+   def grouper(iterable, n, fillvalue=None):
        "Collect data into fixed-length chunks or blocks"
-       # grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
+       # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
        args = [iter(iterable)] * n
        return zip_longest(*args, fillvalue=fillvalue)
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list