[Tutor] Help understanding list comprehensions
Laura Creighton
lac at openend.se
Fri Jun 19 00:20:57 CEST 2015
In a message of Thu, 18 Jun 2015 04:40:05 -0000, Anubhav Yadav writes:
>So I need to create a copy of the list before trying to iterate through the
>list.
>Thanks a lot everyone for their answers.
Er, I think you understand, but what you need to do is to make a copy
of the list, and _interate through the copy_ if you want to remove
things from your list. If you aren't modifying the list in the
loop/function/method/whatever then you don't need a copy.
I think you already got it, but "what you said" != "what you meant". :)
Laura
More information about the Tutor
mailing list