
4 Jul
2018
4 Jul
'18
7:22 a.m.
MRAB wrote:
I think that building an iterable of 2-tuples to pass to 'grouped' is much like following a decorate-sort-undecorate pattern when sorting, or something similar when using 'min' or 'max'. Passing an iterable of items and optionally a key function is simpler, IMHO.
It should certainly be an option, but I don't think it should be the only one. Like with map() vs. comprehensions, sometimes one way is more convenient, sometimes the other.
--
Greg