On Tue, Aug 25, 2009 at 3:43 AM, Emanuele D'Arrigo <man...@gmail.com> wrote:
> Let's say I have a list accessed by two threads, one removing list > items via "del myList[index]" statement the other iterating through > the list and printing out the items via "for item in myList:" > statement. 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. > Am I right to say this -won't- generate exceptions because > the list iterator is not concerned with the list changing in size > under its nose? It kind of concerns about the size, I think. If it just checked the "next" item, that would have been so awesome. > Or are there pitfalls I should be aware of? 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. If you make it work, be sure to share your thoughts =] Good luck, -Xav
-- http://mail.python.org/mailman/listinfo/python-list