"RuntimeError: dictionary changed size during iteration" ; Good atomic copy operations?

Alex Martelli aleaxit at yahoo.com
Sat Mar 11 18:29:02 CET 2006

robert <no-spam at no-spam-no-spam.com> wrote:
> 99.99% no. I would have to use a lock everywhere, where I add or remove
> something into a dict or list of the struct. Thats not the purpose of
> big thread locks. Such simple operations are already atomic by the 
> definition of Python - and thanks to the global interpreter lock. 
> (Otherwise I would leave the Python language, God beware ... :-) )

You have misread the Python Language Reference -- if you can give the
URL on which you have read any such promise of atomicity, I will be glad
to fix the docs to make that unambiguous.

There is no such promise (there may be implementation accidents in some
specific implementation which happen to make some operation atomic, but
NO guarantee even there that the next bugfix won't break that).

Farwell and best of luck in finding other languages which support
threads in a way that is more to your liking than Python -- maybe Ruby
suits you, I don't know for sure though.


More information about the Python-list mailing list