how to cast an instance id

Gonçalo Rodrigues op73418 at
Tue Sep 17 07:34:36 EDT 2002

On Tue, 17 Sep 2002 09:32:08 +0100, Eric Texier <erict at>

>It there a way to create a new reference of  an object
>from the string representation of its id?
>Thanks for any help.
>class foo:
>    def info(self):
>        print self
>a = foo()
>ccc = "newa = 0x%x" % id(a)

AFAIK there isn't - You probably have to go down the bowls of the C
implementation to do it. But why would you need such a contortionist's
act? If you explain your problem maybe the people here in the list can
figure out a Pythonic way to do it.

Best regards,
Gonçalo Rodrigues

More information about the Python-list mailing list