I sing the praises of lambda, my friend and savior!

Paul Rubin http
Mon Oct 11 21:39:51 EDT 2004


Dave Benjamin <ramen at lackingtalent.com> writes:
> that it lacks a more powerful closure construct. For instance, on the dev
> list, as quickly as the new "sort(key=lambda x: x[1])" idiom was introduced,
> people started hunting for ways to squash the lambda, the winners being
> "operator.attrgetter()" and "operator.itemgetter()". 

But why would you want to need to remember such obscure functions?  I
never heard of any of those.  Maybe they should be eliminated instead of
lambda.  There should be one obvious way to do it, and lambda suffices.



More information about the Python-list mailing list