[issue13707] Clarify hash() constancy period

2012-01-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Antoine] > Suggest closing as invalid/rajected. [Martin] > -1. The hash has nothing to do with the lifetime, > but with the value of an object. -- resolution: -> invalid status: open -> closed ___ Python track

[issue13707] Clarify hash() constancy period

2012-01-04 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Terry J. Reedy wrote: > > Terry J. Reedy 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 understandin

[issue13707] Clarify hash() constancy period

2012-01-04 Thread Martin v . Löwis
Martin v. Löwis added the comment: > Martin, I do not understand. The default hash is based on id (as is > default equality comparison), not value. In the default implementation, the id *is* the object's value (i.e. objects, by default, only compare equal if they are identical). So the default

[issue13707] Clarify hash() constancy period

2012-01-03 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue13707] Clarify hash() constancy period

2012-01-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: -1 I concur with Martin. -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailin

[issue13707] Clarify hash() constancy period

2012-01-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: Given that the doc says that use of hash() is to compare dict keys, it does not seem wrong to me to suggest that hash() should be usable to do so. I believe id() and consequently hash() are unique among builtins in being run-dependent. That is currently docum

[issue13707] Clarify hash() constancy period

2012-01-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: You can define a __hash__ that changes if the object changes. It is not recommended, but it's possible. So I agree with Martin that your proposed clarification is wrong. (I also think that it wouldn't bring anything, either) Suggest closing as invalid/rajecte

[issue13707] Clarify hash() constancy period

2012-01-03 Thread Terry J. Reedy
Terry J. Reedy 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