Author Matt Gilson
Recipients Matt Gilson
Date 2017-05-11.17:33:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There is some odd behavior when unpacking the groups from an itertools.groupby result.  For example:

    from itertools import groupby
    from operator import itemgetter

    inputs = ((x > 5, x) for x in range(10))
    (_, a), (_, b) = groupby(inputs, key=itemgetter(0))

On CPython, this results in:

    [(True, 9)]

I would expect it to print out 2 empty lists since the second group would have to be consumed to make sure that there isn't another value yielded from groupby (If there was another value to yield, we'd get a ValueError since we couldn't unpack the correct number of items).

This is the behavior that PyPy had prior to re-implementing to be consistent with CPython in
Date User Action Args
2017-05-11 17:33:01Matt Gilsonsetrecipients: + Matt Gilson
2017-05-11 17:33:01Matt Gilsonsetmessageid: <>
2017-05-11 17:33:01Matt Gilsonlinkissue30346 messages
2017-05-11 17:33:01Matt Gilsoncreate