Efficient Rank Ordering of Nested Lists

Alex Martelli aleax at mac.com
Sun Aug 5 04:29:10 CEST 2007


Cousin Stanley <cousinstanley at gmail.com> wrote:
   ...
>       for i , item in reversed( enumerate( sorted( single_list ) ) ) :
   ...
> TypeError: argument to reversed() must be a sequence

Oops, right.  Well then,

    aux_seq = list(enumerate(sorted(single_list)))
    for i, item in reversed(aux_seq): ...

or the like.


Alex




More information about the Python-list mailing list