> I have two threads that share a python list. One thread adds to the > list with append(), the other thread removes items with pop(). > > My question is -- are python list operations atomic?
Yes, they are in the current implementation of CPython (all versions). Notice that not *all* operations are atomic (e.g. .sort() is not), but both append and pop happen to be atomic (which is primarily because they don't need to call back to user-defined functions, unlike sort). It's not a language property, though; things may be different in Jython or IronPython. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list