This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients alex, docs@python, jcea, lemburg, loewis, pitrou, rhettinger, terry.reedy
Date 2012-01-04.09:13:55
SpamBayes Score 4.446e-08
Marked as misclassified No
Message-id <4F04184E.6020704@egenix.com>
In-reply-to <1325644730.01.0.0342595612945.issue13707@psf.upfronthosting.co.za>
Content
Terry J. Reedy wrote:
> 
> Terry J. Reedy <tjreedy@udel.edu> added the comment:
> 
> Martin, I do not understand. The default hash is based on id (as is default equality comparison), not value. Are you OK with hash values changing if the 'value' changes? My understanding is that changing hash values for objects in sets and dicts is bad, which is why mutable builtins with value-based equality do not have hash values.

Hash values are based on the object values, not their id(). See the
various type implementations as reference. The id() is only used
as hash for objects which don't have a "value" (and thus cannot be
compared).

Given that we have the invariant "a==b => hash(a)==hash(b)" in Python,
it immediately follows that hash values for objects with comparison
method cannot have a lifetime - at least not within the same process
and, depending how you look at it, also not in multi-process
applications.
History
Date User Action Args
2012-01-04 09:13:56lemburgsetrecipients: + lemburg, loewis, rhettinger, terry.reedy, jcea, pitrou, alex, docs@python
2012-01-04 09:13:55lemburglinkissue13707 messages
2012-01-04 09:13:55lemburgcreate