You have to do:

rs.sort(lambda a, b, i=i: cmp(a[i], b[i]))

On Wed, 2001-11-28 at 13:17, Aaron Held wrote:
> Is there an easy way to sort a nested list by passing a param to the sort routine?
> 
> I can sort on any index via
> rs.sort(lambda a,b:cmp(a[0],b[0]))
> 
> but I cannot figure out how to make the list index a variable
> rs.sort(lambda a,b:cmp(a[ i ],b[ i ]))
> 
> Any ideas?
> 
> -Aaron
> 
> 
> 
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> 



_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to