faqts : Computers : Programming : Languages : Python : Common Problems : Threads

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

4 of 8 people (50%) answered Yes
Recently 1 of 4 people (25%) 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.