how to get back an object from its id() value
debatem1 at gmail.com
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 "foo.bar()"
> 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-
for completeness- the trickery: http://www.friday.com/bbum/2007/08/24/python-di/
More information about the Python-list