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

Mel Wilson mwilson at the-wire.com
Mon Apr 23 23:38:45 EDT 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