[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: equals metamethod and hash functions
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 09 Jun 2005 09:08:16 -0700
This gets messy with mutable objects because their equivalence (via __eq)
could change with time.
Assume initially that A and B are not equivalent.
T = { }
T[ A ] = "One"
T[ B ] = "Two"
Now change something so that they are equivalent.
What is the value of T[ A ]? T[ B ]?
What if we introduce a third object C that is equivalent to A and B. What is
the value of T[ C ]? What happens when we assign T[ C ] = "Three"?
Mark