On Aug 4, 7:29 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
> Cousin Stanley <[EMAIL PROTECTED]> 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

The particular embedded list I have been tinkering with is 43 x 3884
and the dictionary approach (as you can probably guess) is a big
improvement over the linear one.  It also has the added benefit of
being compatible with Python24.  If I'm not mistaken the binary
approach suggested by Neil requires Python25.  Since in some
situations I don't have control over the version available I will go
with a variant of the dictionary recipe.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to