Ram Rachum Ram Rachum - 9 months ago 73
Python Question

Get object by id()?

Let's say I have an id of a Python object, which I retrieved by doing

id(thing)
. How do I find
thing
again by the id number I was given?

Answer Source

You'll probably want to consider implementing it another way. Are you aware of the weakref module?

(Edited) The Python weakref module lets you keep references, dictionary references, and proxies to objects without having those references count in the reference counter. They're like symbolic links.