Raymond Hettinger added the comment:

> what set() operations are atomic?

The language doesn't make any guarantees about set operation atomicity.  
Different implementations such as PyPy, Jython, and IronPython are free to make 
different choices than CPython.  In general, users should make no assumptions 
about atomicity unless explicitly documented and tested.  The wise course of 
action is to use mutexes when there is any doubt.

FWIW, it is difficult to make blanket statements about the methods on sets 
because the atomicity depends on the objects looked up or stored in the sets 
rather than the set itself.   Aside from trivial calls to __sizeof__ and 
__len__, most set methods potentially call __hash__ or __eq__ on the set 
elements either of which could make a callback into pure python code.  
Likewise, any reference count decrement can potentially make a callback as well.

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25343>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to