Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Fredrik Lundh
Girish Sahani wrote: > Thanks!It workedi wasted a lot of time trying to find a bug in my > code...what is wrong in iterating over a list and modifying it? > Doesnt python take the modified list every time the loop starts? this is explained in the tutorial, under "the for statement": The

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Fredrik Lundh
Girish Sahani wrote: > Btw going slightly off-topic, when i try to run a code like below with > around 50 elements (pairs) in l4,python just hangs. Any ideas why this is > happening...the data is not that large :(( building a filtered new list by repeatedly removing stuff from a copy of the origi

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Paul McGuire
"Girish Sahani" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I am trying to modify a list of pairs (l4) by removing those > pairs which are not present in a third list called pairList. > The following is a simplified part of the routine i have written. However > it does not

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Boris Borcic
Girish Sahani wrote: > Hi, > I am trying to modify a list of pairs (l4) by removing those > pairs which are not present in a third list called pairList. > The following is a simplified part of the routine i have written. However > it does not give the correct output. Please help! > Its possible

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Maric Michaud
Le Lundi 12 Juin 2006 11:06, Girish Sahani a écrit : > Thanks!It workedi wasted a lot of time trying to find a bug in my > code...what is wrong in iterating over a list and modifying it? > Doesnt python take the modified list every time the loop starts? Python iterates over an iterator, that m

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Girish Sahani
Thank you Markthis works too... Btw going slightly off-topic, when i try to run a code like below with around 50 elements (pairs) in l4,python just hangs. Any ideas why this is happening...the data is not that large :(( > > Girish Sahani wrote: >> Hi, >> I am trying to modify a list of pairs (

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Girish Sahani
Thanks!It workedi wasted a lot of time trying to find a bug in my code...what is wrong in iterating over a list and modifying it? Doesnt python take the modified list every time the loop starts? Also in this case, i want to add a condition that if none of the pairs are in pairList, element = [

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread [EMAIL PROTECTED]
Girish Sahani wrote: > Hi, > I am trying to modify a list of pairs (l4) by removing those > pairs which are not present in a third list called pairList. > The following is a simplified part of the routine i have written. However > it does not give the correct output. Please help! > Its possible

Re: Function to remove elements from a list not working (corrected)

2006-06-12 Thread Maric Michaud
Le Lundi 12 Juin 2006 10:25, Girish Sahani a écrit : > Hi, > I am trying to modify a list of pairs (l4) by removing those > pairs which are not present in a third list called pairList. > The following is a simplified part of the routine i have written. However > it does not give the correct outpu

Function to remove elements from a list not working (corrected)

2006-06-12 Thread Girish Sahani
Hi, I am trying to modify a list of pairs (l4) by removing those pairs which are not present in a third list called pairList. The following is a simplified part of the routine i have written. However it does not give the correct output. Please help! Its possible i have made a trivial mistke sinc