how to get back an object from its id() value

CTO debatem1 at
Wed Apr 8 18:09:03 CEST 2009

> But how do I get a usable reference from the id value?
> For example, if "foo" has a method "bar()", how can I call ""
> from "str(id(foo))" (say, 149466208).

can you just use a weakref instead? It is certainly cleaner than
trying to store id's,
since an id is only guaranteed to be unique for the lifetime of the
object in question,
and the only way I know of correlating id's to objects involves some C-
level trickery.

for completeness- the trickery:

More information about the Python-list mailing list