Fix Python – Get object by id()? [duplicate]


Asked By – Ram Rachum

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?

Now we will see solution for issue: Get object by id()? [duplicate]


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.

This question is answered By – Ken Kinder

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0