[Python-Dev] Why should the default hash(x) == id(x)?
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Nov 3 01:39:44 CET 2005
Noam Raphael wrote:
> 3. If someone does want to associate values with objects, he can
> explicitly use id:
> dct[id(x)] = 3.
This is fragile. Once all references to x are dropped,
it is possible for another object to be created having
the same id that x used to have. The dict now
unintentionally references the new object.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list