Message293526
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)) |
|
Date |
User |
Action |
Args |
2017-05-12 06:33:03 | rhettinger | set | recipients:
+ rhettinger, Matt Gilson |
2017-05-12 06:33:03 | rhettinger | set | messageid: <1494570783.92.0.149553050307.issue30346@psf.upfronthosting.co.za> |
2017-05-12 06:33:03 | rhettinger | link | issue30346 messages |
2017-05-12 06:33:03 | rhettinger | create | |
|