sorting the list by inner elements

Josiah Carlson jcarlson at nospam.uci.edu
Sat Mar 27 01:43:03 EST 2004


> This works !!! , thanks.
> but I would like to know something that
> i heard use of lambda function is not good !. So why it is not good,
> or in when we should not use lambda function.

There is nothing explicitly wrong with using lambda.  However, unless 
the lambda you are using is easy to understand, you may not understand 
how or why it works later.  The lambda given to you works just fine, but 
if you are afraid of using lambdas, here you go:

def cmp_1(x,y):
     return cmp(x[1], y[1])

  - Josiah



More information about the Python-list mailing list