Why are tuples immutable?

Fredrik Lundh fredrik at pythonware.com
Tue Dec 21 13:35:20 EST 2004


Jeff Shannon wrote:

> So show us a dictionary (i.e. hash table) implementation that can do this.  You'll need to be able 
> to derive the old hash from the new hash, of course, so that you can correctly associate the 
> values already stored under that key.  And you'll have to be able to do that without referring to 
> the pre-modified object again, because dicts can't track every Python operation that might modify 
> a key object.  And it needs to deal properly with equivalent-but-different-ID list literals, 
> because using literals (and not references stored elsewhere) is an important and common dict key 
> usage.

and to temporarily refer back to the top of this thread, do all this without
any performance impact, compared to the current implementation.

</F> 






More information about the Python-list mailing list