Converting python object reference to int and back

Terry Reedy tjreedy at
Sat Sep 7 18:23:14 EDT 2002

"Martin v. Loewis" <martin at> wrote in message
news:m38z2e2qef.fsf at
> Ahmad Baitalmal <ahmad at> writes:
> > How can I get an id (pointer/reference) from a python object and
> > get that object back using that integer?
> To get an integer, use the id function. To get the object back,
> a dictionary mapping the ids to the real objects.

While this answers the OP's question as presented, it seems pretty
useless (and unlikely to solve the real question not asked).  Since
the 'real objects' are represented internally by the same id used as
the key, such a dict would amount to an identity mapping.


More information about the Python-list mailing list