list vs tuple for a dict key- why aren't both hashable?

MRAB python at mrabarnett.plus.com
Sun Nov 8 13:52:06 EST 2009


Wells wrote:
> I'm not quite understanding why a tuple is hashable but a list is not.
> Any pointers? Thanks!

A hash is created from the object. If the object is mutable then the
hash can change. Lists are mutable but tuples aren't.



More information about the Python-list mailing list