how to cast an instance id

Gonçalo Rodrigues op73418 at mail.telepac.pt
Tue Sep 17 07:34:36 EDT 2002


On Tue, 17 Sep 2002 09:32:08 +0100, Eric Texier <erict at millfilm.co.uk>
wrote:

>
>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()
>a.info()
>ccc = "newa = 0x%x" % id(a)
>exec(ccc)
>
>

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