[Python-ideas] An identity dict

Benjamin Peterson benjamin at python.org
Tue Jun 1 02:44:41 CEST 2010

Raymond Hettinger <raymond.hettinger at ...> writes:
> Also, I haven't seen much of a discussion of use cases.

Here's a selection of use cases from PyPy's source (You can search for
"identity_dict" to see its use):

In a algorithm for breaking cycles in graphs:

Keeping track of all the allocated objects in a model of a low level runtime:

Tracing the source of a certain kind of type as our type checker annotate
RPython: http://codespeak.net/svn/pypy/trunk/pypy/annotation/bookkeeper.py

Traversing the blocks of a function's graph:

Essentially these are places where defined equality should not matter.

I could also use it here:

More information about the Python-ideas mailing list