[Python-ideas] Allow a group by operation for dict comprehension

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jun 29 01:39:51 EDT 2018

Steven D'Aprano wrote:
> On Thu, Jun 28, 2018 at 10:01:00AM -0700, Chris Barker via Python-ideas wrote:
>     In [*46*]: {a:[t[0] *for* t *in* b] *for* a,b *in*
>     groupby(sorted(student_school_list,
>     key=*lambda* t: t[1]), key=*lambda* t: t[
>     ...
 > the rest ought to be legal Python but isn't

We should *make* it legal Python code! Then there would be no
difficulty with adding new keywords!


More information about the Python-ideas mailing list