how to cast an instance id
Darrell
dgallion1 at yahoo.com
Tue Sep 17 12:42:09 EDT 2002
class foo:
def info(self):
print self
a = foo()
a.info()
ccc = "%s()"%( str(a.__class__).split(".")[-1], )
eval(ccc).info()
exec("b=%s"%ccc)
b.info()
<__main__.foo instance at 0x00767378>
<__main__.foo instance at 0x007673B0>
<__main__.foo instance at 0x007673B0>
--Darrell
Eric Texier <erict at millfilm.co.uk> wrote in message news:<3D86E888.90AF569 at millfilm.co.uk>...
> It there a way to create a new reference of an object
> from the string representation of its id?
> Thanks for any help.
>
More information about the Python-list
mailing list