List iterator thread safety

Emanuele D'Arrigo manu3d at gmail.com
Mon Aug 24 13:43:24 EDT 2009


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. 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? Or are there pitfalls I should be aware of?

Manu



More information about the Python-list mailing list