Message303183
Except for display the last few elements, this is the documented and intended behavior: ( https://docs.python.org/3/library/itertools.html#itertools.groupby ):
'''
The returned group is itself an iterator that shares the underlying iterable with groupby(). Because the source is shared, when the groupby() object is advanced, the previous group is no longer visible. So, if that data is needed later, it should be stored as a list:
groups = []
uniquekeys = []
data = sorted(data, key=keyfunc)
for k, g in groupby(data, keyfunc):
groups.append(list(g)) # Store group iterator as a list
uniquekeys.append(k)
'''
The display of the last few elements isn't supposed to happen. That is being fixed so that all of the subiterator results are empty when the parent iterator is exhausted. |
|
Date |
User |
Action |
Args |
2017-09-27 21:29:33 | rhettinger | set | recipients:
+ rhettinger, Loïc Le Loarer |
2017-09-27 21:29:33 | rhettinger | set | messageid: <1506547773.54.0.273299129313.issue31614@psf.upfronthosting.co.za> |
2017-09-27 21:29:33 | rhettinger | link | issue31614 messages |
2017-09-27 21:29:33 | rhettinger | create | |
|