On Sun, Nov 28, 2021 at 04:48:01PM -0800, Christopher Barker wrote: > One example was a proposal a while back on this list for a "groupby" in > itertools (it kind of withered on the vine, like many good ideas here), I > suggested that it be made comprehension friendly, and some others including > the OP) didn't see the point.
How is itertools.groupby not comprehension friendly? >>> from itertools import groupby >>> for key, chunk in groupby( ... (x*3 for x in [2, 4, 1, 3, 5, 0, 6]), ... lambda a: a%2): ... print(key, list(chunk)) ... 0 [6, 12] 1 [3, 9, 15] 0 [0, 18] _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LJCK52SATH2KY4GQCXR54CO7PZDVL7GH/ Code of Conduct: http://python.org/psf/codeofconduct/