sort problem

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Fri Oct 21 03:15:19 EDT 2005


Kent Johnson wrote:
> or learn about decorate-sort-undecorate:
> 
> lst = [ ...whatever ] lst = [ x[3], i, x for i, x in enumerate(lst) ]
> 
I think that here the code must be changed (for the future):
lst = [ (x[3], i, x) for i, x in enumerate(lst) ]

> lst.sort() lst = [ x for _, _, x in lst ]


Wow, this work with my py 2.3!

> 
> Kent
> 

Thanks,
Michele



More information about the Python-list mailing list