[Python-Dev] Re: Pre-PEP: Mutable keys in dictionaries

Guido van Rossum guido@python.org
Thu, 06 Feb 2003 13:58:51 -0500


> Can __temporary_immutable__ work on a multi-threaded system?  What is to 
> prevent the (known to be mutable) key from changing underneath you during 
> the lookup?  Perhaps I am misunderstanding, but it seems to me that you 
> must either copy the mutable key or be able to block all writers to the key 
> during the lookup.

The sets module has this problem now.  Our approach to this is to
document that sets are not thread-safe.

--Guido van Rossum (home page: http://www.python.org/~guido/)