On Tue, Aug 25, 2009 at 3:43 AM, Emanuele D'Arrigo <span dir="ltr"><<a href="mailto:manu3d@gmail.com">manu3d@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Let's say I have a list accessed by two threads, one removing list<br>
items via "del myList[index]" statement the other iterating through<br>
the list and printing out the items via "for item in myList:"<br>
statement.</blockquote><div><br>I tried something similar to that before. Gave me an error. I *think* it was in compile-time, too, but I might be wrong. The message was something like that the list size cannot be changed.<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Am I right to say this -won't- generate exceptions because<br>
the list iterator is not concerned with the list changing in size<br>
under its nose?</blockquote><div><br>It kind of concerns about the size, I think. If it just checked the "next" item, that would have been so awesome.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Or are there pitfalls I should be aware of?</blockquote><div><br>The pitfall is that I don't think it will work at all. At least I haven't succeeded in doing this in the past.<br><br>If you make it work, be sure to share your thoughts =]<br>
<br>Good luck,<br>-Xav<br></div></div><br>