Re: seemingly simple list indexing problem

2008-07-30 Thread John Krukoff
On Wed, 2008-07-30 at 14:08 -0700, [EMAIL PROTECTED] wrote: > On 29 Jul., 01:05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > [Ervan Ensis] > > > > > I have a list like [108, 58, 68]. I want to return > > > the sorted indices of these items in the same order > > > as the original list. So I

Re: seemingly simple list indexing problem

2008-07-30 Thread wolfram . hinderer
On 29 Jul., 01:05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Ervan Ensis] > > > I have a list like [108, 58, 68]. I want to return > > the sorted indices of these items in the same order > > as the original list. So I should return [2, 0, 1] > > One solution is to think of the list indexes

Re: seemingly simple list indexing problem

2008-07-30 Thread John Krukoff
On Wed, 2008-07-30 at 12:06 -0700, Tobiah wrote: > On Mon, 28 Jul 2008 23:41:51 -0700, iu2 wrote: > > > On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: > >> On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > >> > >> > >> > >> > >> > >> > On Mon, 2008-07-28 at 16:24 -0500, Er

Re: seemingly simple list indexing problem

2008-07-30 Thread Tobiah
On Mon, 28 Jul 2008 23:41:51 -0700, iu2 wrote: > On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: >> On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: >> > > My programming skills are pretty rusty and I'm

Re: seemingly simple list indexing problem

2008-07-28 Thread iu2
On Jul 29, 2:26 am, John Krukoff <[EMAIL PROTECTED]> wrote: > On Mon, 2008-07-28 at 16:00 -0700, iu2 wrote: > > On Jul 29, 12:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > > > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > > > My programming skills are pretty rusty and I'm just learni

Re: seemingly simple list indexing problem

2008-07-28 Thread iu2
On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > > > > > > > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > > My programming skills are pretty rusty and I'm just learning Python so > > > this problem is giving me t

Re: seemingly simple list indexing problem

2008-07-28 Thread John Machin
On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > My programming skills are pretty rusty and I'm just learning Python so > > this problem is giving me trouble. > > > I have a list like [108, 58, 68]. I want to return the sorted

Re: seemingly simple list indexing problem

2008-07-28 Thread John Machin
Guilherme Polo wrote: > It wasn't supposed to be the fastest solution, also, he didn't mention > duplicated items. He didn't need to. He explicitly said "list" (which permits duplicates) and didn't mention a self-imposed uniqueness constraint. -- http://mail.python.org/mailman/listinfo/python-l

Re: seemingly simple list indexing problem

2008-07-28 Thread John Krukoff
On Mon, 2008-07-28 at 16:00 -0700, iu2 wrote: > On Jul 29, 12:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > > My programming skills are pretty rusty and I'm just learning Python so > > > this problem is giving me trouble. > > > > > I h

Re: seemingly simple list indexing problem

2008-07-28 Thread Raymond Hettinger
[Ervan Ensis] > I have a list like [108, 58, 68].  I want to return > the sorted indices of these items in the same order > as the original list.  So I should return [2, 0, 1] One solution is to think of the list indexes being sorted according the their corresponding values in the input array: >

Re: seemingly simple list indexing problem

2008-07-28 Thread iu2
On Jul 29, 12:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > My programming skills are pretty rusty and I'm just learning Python so > > this problem is giving me trouble. > > > I have a list like [108, 58, 68].  I want to return the sorted

Re: seemingly simple list indexing problem

2008-07-28 Thread Guilherme Polo
On Mon, Jul 28, 2008 at 7:00 PM, Gary Herron <[EMAIL PROTECTED]> wrote: > Guilherme Polo wrote: >> >> On Mon, Jul 28, 2008 at 6:24 PM, Ervan Ensis <[EMAIL PROTECTED]> >> wrote: >> >>> >>> My programming skills are pretty rusty and I'm just learning Python so >>> this >>> problem is giving me troubl

Re: seemingly simple list indexing problem

2008-07-28 Thread John Krukoff
On Mon, 2008-07-28 at 15:00 -0700, Gary Herron wrote: > Guilherme Polo wrote: > > On Mon, Jul 28, 2008 at 6:24 PM, Ervan Ensis <[EMAIL PROTECTED]> wrote: > > > >> My programming skills are pretty rusty and I'm just learning Python so this > >> problem is giving me trouble. > >> > >> I have a li

Re: seemingly simple list indexing problem

2008-07-28 Thread John Krukoff
On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > My programming skills are pretty rusty and I'm just learning Python so > this problem is giving me trouble. > > I have a list like [108, 58, 68]. I want to return the sorted indices > of these items in the same order as the original list. S

Re: seemingly simple list indexing problem

2008-07-28 Thread John Krukoff
On Mon, 2008-07-28 at 18:40 -0300, Guilherme Polo wrote: > On Mon, Jul 28, 2008 at 6:24 PM, Ervan Ensis <[EMAIL PROTECTED]> wrote: > > My programming skills are pretty rusty and I'm just learning Python so this > > problem is giving me trouble. > > > > I have a list like [108, 58, 68]. I want to

Re: seemingly simple list indexing problem

2008-07-28 Thread Gary Herron
Guilherme Polo wrote: On Mon, Jul 28, 2008 at 6:24 PM, Ervan Ensis <[EMAIL PROTECTED]> wrote: My programming skills are pretty rusty and I'm just learning Python so this problem is giving me trouble. I have a list like [108, 58, 68]. I want to return the sorted indices of these items in the

Re: seemingly simple list indexing problem

2008-07-28 Thread Guilherme Polo
On Mon, Jul 28, 2008 at 6:24 PM, Ervan Ensis <[EMAIL PROTECTED]> wrote: > My programming skills are pretty rusty and I'm just learning Python so this > problem is giving me trouble. > > I have a list like [108, 58, 68]. I want to return the sorted indices of > these items in the same order as the

seemingly simple list indexing problem

2008-07-28 Thread Ervan Ensis
My programming skills are pretty rusty and I'm just learning Python so this problem is giving me trouble. I have a list like [108, 58, 68]. I want to return the sorted indices of these items in the same order as the original list. So I should return [2, 0, 1] For a list that's already in order,