7 Oct
2011
7 Oct
'11
7:06 a.m.
Eric Snow wrote:
So, is being hashable necessarily tied to being immutable?
It's tied to immutability of those aspects involved in equality comparison. If a type is to behave predictably when used as a dict key, then two instances that compare equal must always compare equal, and the converse. Attributes that don't affect equality comparison are free to change, however. -- Greg