Raymond Hettinger added the comment:

I suppose that when the input iterator is exhausted, we could poison the 
currkey to make the subordinate iterator ends as well:

    def __next__(self):
        while self.currkey == self.tgtkey:
            try:    
                self.currvalue = next(self.it)
            except StopIteration:
                self.currkey = object()
                raise StopIteration from None
            self.currkey = self.keyfunc(self.currvalue)
        self.tgtkey = self.currkey
        return (self.currkey, self._grouper(self.tgtkey))

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30346>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to