[Python-ideas] grouping / dict of lists

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jul 3 19:22:40 EDT 2018


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


More information about the Python-ideas mailing list