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 Loïc Le Loarer, rhettinger
Date 2017-09-27.21:29:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506547773.54.0.273299129313.issue31614@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-09-27 21:29:33rhettingersetrecipients: + rhettinger, Loïc Le Loarer
2017-09-27 21:29:33rhettingersetmessageid: <1506547773.54.0.273299129313.issue31614@psf.upfronthosting.co.za>
2017-09-27 21:29:33rhettingerlinkissue31614 messages
2017-09-27 21:29:33rhettingercreate