I think in this case the Python docs were mis-interpreted. The key
point to consider when writing a __hash__ function is that two objects
that compare equal must hash equally, and the hash value cannot
change. Just because an object is mutable doesn't mean that these
rules will be violated. In
David Abrahams wrote:
> I just wrote some code that used Model instances as keys in a dict,
> and was surprised to find two instances in the dict that represented
> the same object in the database. Shouldn't that be impossible? If
> you can't guarantee that a given object in the database is alwa
I just wrote some code that used Model instances as keys in a dict,
and was surprised to find two instances in the dict that represented
the same object in the database. Shouldn't that be impossible? If
you can't guarantee that a given object in the database is always
represented by the same Py
3 matches
Mail list logo