This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Matt Gilson, rhettinger
Date 2017-05-12.06:33:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494570783.92.0.149553050307.issue30346@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2017-05-12 06:33:03rhettingersetrecipients: + rhettinger, Matt Gilson
2017-05-12 06:33:03rhettingersetmessageid: <1494570783.92.0.149553050307.issue30346@psf.upfronthosting.co.za>
2017-05-12 06:33:03rhettingerlinkissue30346 messages
2017-05-12 06:33:03rhettingercreate