Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Christopher Subich wrote:
>
> > Chris Mellon wrote:
> >> functions with real names is crucial to maintainable code. The only
> >> reason to ever use a lamdba in Python is because you don't want to
> >> give a function a name, and that is just not a compelling use case for
> >> GUI events.
> >
> > Ah, but that neglects the sheer utility of delayed-evaluation
> > expressions.  Consider the key= parameter to list.sort, et. al:
> >
> > complicated_list.sort(key=lambda x: x[3])
>
> This can be written as::
>
>   from operator import itemgetter
>   complicated_list.sort(key=itemgetter(3))
>
Though I find the lambda form easier for me to understand but
itemgetter should be the preferred way as it should have some
performance advantage and sort are those kind of functions that need
it, in general.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to