
On Tue, Jul 14, 2009 at 3:16 PM, Paul Moore<p.f.moore@gmail.com> wrote:
2009/7/14 Chris Perkins <chrisperkins99@gmail.com>:
y = sorted(x, key=&) do(item): name = item.split('-')[1] return name.upper()
I think that forcing that two-line block of code to have a name would serve no purpose - it's abundantly clear what it does.
That's a very telling statement. To me, that code is utterly baffling. (Seriously! Without analysing it line by line, it means nothing to me).
Seconded, there's too much going on ('&', what's "do", a function ?, what's "item" ?, etc.). FWIW the only readable suggestion for multiline lambdas with almost zero learning curve I have seen is the one implemented in Boo, anonymous def and regular indentation: y = sorted(x, key=def (item): name = item.split('-')[1] return name.upper() ) There must be somewhere posted the reason this was rejected but my google-fu is failing me. George [1] http://boo.codehaus.org/Closures