how to get back an object from its id() value
Tribulations at Paralleles.invalid
Wed Apr 8 17:46:11 CEST 2009
I have a data structure (a tree) that has one constraint: I can only store
strings in this data structure.
To know if an object foo already exists in memory, I store "str(id(foo))" in
the data structure.
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).
Thanks in advance,
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
More information about the Python-list