Re: List loops

2007-10-09 Thread Bill Hamilton
On 10/9/07, John Machin <[EMAIL PROTECTED]> wrote: > On 10/10/2007 1:33 AM, Hamilton, William wrote: > >> From: Tommy Grav > >> > >> Hi everyone, > >> > >>I have a list of objects where I have want to do two loops. > >> I want to loop over the list and inside this loop, work on all > >> the ele

Re: List loops

2007-10-09 Thread John Machin
On 10/10/2007 1:00 AM, Chris Mellon wrote: > On 10/9/07, Tommy Grav <[EMAIL PROTECTED]> wrote: >> Hi everyone, >> >>I have a list of objects where I have want to do two loops. >> I want to loop over the list and inside this loop, work on all >> the elements of the list after the one being handl

Re: List loops

2007-10-09 Thread John Machin
On 10/10/2007 1:33 AM, Hamilton, William wrote: >> From: Tommy Grav >> >> Hi everyone, >> >>I have a list of objects where I have want to do two loops. >> I want to loop over the list and inside this loop, work on all >> the elements of the list after the one being handled in the outer The man

Re: List loops

2007-10-09 Thread John Machin
On 10/10/2007 12:30 AM, Tommy Grav wrote: > Hi everyone, > > I have a list of objects where I have want to do two loops. > I want to loop over the list and inside this loop, work on all > the elements of the list after the one being handled in the outer > loop. I can of course do this with index

RE: List loops

2007-10-09 Thread Hamilton, William
> From: Tommy Grav > > Hi everyone, > >I have a list of objects where I have want to do two loops. > I want to loop over the list and inside this loop, work on all > the elements of the list after the one being handled in the outer > loop. I can of course do this with indexes: > > >>> alist

Re: List loops

2007-10-09 Thread Chris Mellon
On 10/9/07, Tommy Grav <[EMAIL PROTECTED]> wrote: > Hi everyone, > >I have a list of objects where I have want to do two loops. > I want to loop over the list and inside this loop, work on all > the elements of the list after the one being handled in the outer > loop. I can of course do this wi

Re: List loops

2007-10-09 Thread Tim Chase
> >>> alist = range(3) > >>> for i in xrange(len(alist)): > ... for j in xrange(i+1,len(alist)): > ... print i,j,alist[i],alist[j] > ... > 0 1 0 1 > 0 2 0 2 > 1 2 1 2 > >>> > > > Is there a way to do this without using indexes? The following works for me, replicating your code, >>> al

List loops

2007-10-09 Thread Tommy Grav
Hi everyone, I have a list of objects where I have want to do two loops. I want to loop over the list and inside this loop, work on all the elements of the list after the one being handled in the outer loop. I can of course do this with indexes: >>> alist = range(3) >>> for i in xrange(len(a