Tuples -- who needs 'em
Greg Ewing
greg at cosc.canterbury.ac.nz
Wed Apr 5 00:42:44 EDT 2000
Mike Fletcher wrote:
>
> The question of what a "meaningful" hash function would be for a mutable
> sequence is the crux of the issue
The important thing is whether the object *behaves* immutably
as far as comparison is concerned. If two objects a and b of a type T
have the property that a == b always returns the same result regardless
of what is done to a or b, then it makes sense to use objects of type T
as dictionary keys. But there has to be *something* about them that can
be regarded as immutable. So, in that broader sense, the statement that
"only immutable objects can be used as dictionary keys" remains correct.
--
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Python-list
mailing list