[Python-Dev] Lambda [was Re: PEP 8 modernisation]

Chris Angelico rosuav at gmail.com
Thu Aug 1 19:01:39 CEST 2013


On Thu, Aug 1, 2013 at 5:58 PM, Alexander Shorin <kxepal at gmail.com> wrote:
> fun = lambda i: i[1]
> for key, items in groupby(sorted(items, key=fun), key=fun):
>   print(key, ':', list(items))

I'd do a direct translation to def here:

def fun(i): return i[1]
for key, items in groupby(sorted(items, key=fun), key=fun):
  print(key, ':', list(items))

ChrisA


More information about the Python-Dev mailing list