[Tutor] 2 problems in a small script

Dick Moores rdm at rcblue.com
Fri Oct 12 09:02:29 CEST 2007


At 11:25 PM 10/11/2007, Aditya Lal wrote:
>Hi Dick,
>
>You are deleting from the SAME list that you are traversing. This 
>results in problems.

Aditya,

Well, if deleting from the same list I'm traversing is the problem, 
why doesn't inserting the line
lstB = lstA

and deleting from lstB clear it up? The output is exactly the same. 
I'm really puzzled. See <http://www.rcblue.com/Python/buggy_For_Web2.py>

I thank you for showing me another way to get the result I want, but 
first I want to know why my code didn't work.

Dick



More information about the Tutor mailing list