Faqts : Business : Programming : Shopping For You : Python : Common Problems : Lists

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 10 people (60%) answered Yes
Recently 3 of 6 people (50%) answered Yes

Entry

Can two threads get in each others' way if they simultaneously try to mutate a list?
Can two threads get in each others' way if they simultaneously try to mutate a list?

Jun 18th, 2000 08:04
unknown unknown, Aahz Maruch


It depends how they mutate it.  I believe that single builtin functions
(e.g. [].append()) are thread-safe.  OTOH, [].sort() may not be
thread-safe, particularly if you've got user-defined classes on the list
with __cmp__() defined.