Efficient Rank Ordering of Nested Lists

Alex Martelli aleax at mac.com
Sat Aug 4 22:29:10 EDT 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