When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

Mel Wilson mwilson at the-wire.com
Tue Apr 24 05:38:45 CEST 2007


Neil Cerutti wrote:

> The interpreter explains it: "A list is not a hashable object."
> Choosing a hash table instead of some kind of balanced tree seems
> to be just an optimization. ;)

Even with a balanced tree, if a key in a node changes value, you may 
have to re-balance the tree.  Nothing in a Python list says that a 
dictionary tree would have to be re-balanced if you changed that 
particular list.

	Mel.




More information about the Python-list mailing list