Martin Drautzburg wrote: > Is it possible to convert an object into a string that identifies the > object in a way, so it can later be looked up by this string. > Technically this should be possible, because things like > > <__main__.Foo instance at 0xb7cfb6ac> > > say everything about an object. But how can I look up the real object, > when I only have this string? > > I know such a thing can be achieved with a dictionary that holds > reference-object pairs. Is there another way?
How about: class Dog(object): def __init__(self, name): self.name = name d = Dog("Spot") print globals()["d"].name -- http://mail.python.org/mailman/listinfo/python-list