how to get back an object from its id() value
TP
Tribulations at Paralleles.invalid
Wed Apr 8 11:46:11 EDT 2009
Hi everybody,
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.
OK.
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,
Julien
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"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
mailing list