Re: Efficient Rank Ordering of Nested Lists

2007-08-05 Thread [EMAIL PROTECTED]
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_

Re: Efficient Rank Ordering of Nested Lists

2007-08-04 Thread Cousin Stanley
> 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 r

Re: Efficient Rank Ordering of Nested Lists

2007-08-04 Thread Alex Martelli
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):

Re: Efficient Rank Ordering of Nested Lists

2007-08-04 Thread Cousin Stanley
> > "beginner"'s advice to use a dictionary is also good > and may turn out to be faster, just because dicts are > SO fast in Python -- but you need to try and measure > both alternatives. > > One way to use a dict ( warning, untested code ) : def rank_list( single_list ) : d =

Re: Efficient Rank Ordering of Nested Lists

2007-08-04 Thread [EMAIL PROTECTED]
On Aug 3, 5:53 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-08-03, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > A naive approach to rank ordering (handling ties as well) of nested > > lists may be accomplished via: > > >def rankLists(nestedList): > > def rankList(single

Re: Efficient Rank Ordering of Nested Lists

2007-08-04 Thread [EMAIL PROTECTED]
On Aug 3, 9:20 am, [EMAIL PROTECTED] wrote: > On Aug 2, 10:20 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > A naive approach to rank ordering (handling ties as well) of nested > > lists may be accomplished via: > > >def rankLists(nestedList): > > def rankList(singleList):

Re: Efficient Rank Ordering of Nested Lists

2007-08-04 Thread [EMAIL PROTECTED]
On Aug 3, 8:38 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > A naive approach to rank ordering (handling ties as well) of nested > > lists may be accomplished via: > > >def rankLists(nestedList): > > def rankList(singleList): > >

Re: Efficient Rank Ordering of Nested Lists

2007-08-03 Thread pyscottishguy
On Aug 2, 10:20 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > A naive approach to rank ordering (handling ties as well) of nested > lists may be accomplished via: > >def rankLists(nestedList): > def rankList(singleList): > sortedList = list(singleList) > sortedL

Re: Efficient Rank Ordering of Nested Lists

2007-08-03 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > A naive approach to rank ordering (handling ties as well) of nested > lists may be accomplished via: > >def rankLists(nestedList): > def rankList(singleList): > sortedList = list(singleList) > sortedList.sort() >

Re: Efficient Rank Ordering of Nested Lists

2007-08-03 Thread Neil Cerutti
On 2007-08-03, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > A naive approach to rank ordering (handling ties as well) of nested > lists may be accomplished via: > >def rankLists(nestedList): > def rankList(singleList): > sortedList = list(singleList) > sortedList.sor

Re: Efficient Rank Ordering of Nested Lists

2007-08-02 Thread beginner
On Aug 2, 8:20 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > A naive approach to rank ordering (handling ties as well) of nested > lists may be accomplished via: > >def rankLists(nestedList): > def rankList(singleList): > sortedList = list(singleList) > sortedLi

Efficient Rank Ordering of Nested Lists

2007-08-02 Thread [EMAIL PROTECTED]
A naive approach to rank ordering (handling ties as well) of nested lists may be accomplished via: def rankLists(nestedList): def rankList(singleList): sortedList = list(singleList) sortedList.sort() return map(sortedList.index, singleList) return map(r