[Python-checkins] r69910 - python/branches/release30-maint/Doc/library/itertools.rst

raymond.hettinger python-checkins at python.org
Mon Feb 23 20:44:00 CET 2009


Author: raymond.hettinger
Date: Mon Feb 23 20:44:00 2009
New Revision: 69910

Log:
Update itertools recipes to use next().

Modified:
   python/branches/release30-maint/Doc/library/itertools.rst

Modified: python/branches/release30-maint/Doc/library/itertools.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/itertools.rst	(original)
+++ python/branches/release30-maint/Doc/library/itertools.rst	Mon Feb 23 20:44:00 2009
@@ -240,14 +240,14 @@
               return self
           def __next__(self):
               while self.currkey == self.tgtkey:
-                  self.currvalue = next(self.it) # Exit on StopIteration
+                  self.currvalue = next(self.it)    # Exit on StopIteration
                   self.currkey = self.keyfunc(self.currvalue)
               self.tgtkey = self.currkey
               return (self.currkey, self._grouper(self.tgtkey))
           def _grouper(self, tgtkey):
               while self.currkey == tgtkey:
                   yield self.currvalue
-                  self.currvalue = next(self.it) # Exit on StopIteration
+                  self.currvalue = next(self.it)    # Exit on StopIteration
                   self.currkey = self.keyfunc(self.currvalue)
 
 
@@ -566,8 +566,7 @@
    def pairwise(iterable):
        "s -> (s0,s1), (s1,s2), (s2, s3), ..."
        a, b = tee(iterable)
-       for elem in b:
-           break
+       next(b, None)
        return zip(a, b)
 
    def grouper(n, iterable, fillvalue=None):


More information about the Python-checkins mailing list