A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-November/057893.html below:

[Python-Dev] Why should the default hash(x) == id(x)?

[Python-Dev] Why should the default hash(x) == id(x)? [Python-Dev] Why should the default hash(x) == id(x)?Noam Raphael noamraph at gmail.com
Fri Nov 4 13:02:31 CET 2005
On 11/3/05, Greg Ewing <greg.ewing at canterbury.ac.nz> 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.
>
You are right. Please see the simple "ref" class that I wrote in my
previous post, which solves this problem.

Noam
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4