Convert obejct string repr to actual object

English, Mark Mark.English at rbccm.com
Mon Oct 15 11:48:27 EDT 2007


X-Replace-Address: mark.ignorethisbit.english at xxxrbccmxxx.ignorethisbittoo_and_removethosepreceding_xxxs_.com
On 12 Oct, 18:14, Carsten Haese <cars... at uniqsys.com> wrote:
> On Fri, 2007-10-12 at 17:41 +0100, English, Mark wrote:
> > > From: Tor Erik Sønvisen
> > > Date: October 8th 2007
> > > I've tried locating some code that can recreate an object from
> > > it's string representation...
> > On a related note I've wondered about this:
> > >>> class Foo(object): pass
> > >>> f = Foo()
> > >>> s = repr(f)
> > >>> s
> > '<__main__.Foo object at 0x007CBAB0>'
> > So how do I get f back from s ?
> 
> I can't help but wonder, do you often find yourself having to locate an
> object from its hexadecimal address?
Never. This just didn't feel particularly repr-ish to me:
"For many types, this function makes an attempt to return a string that would yield an
 object with the same value when passed to eval()"

I was just asking in case I was missing some mechanism which made new style class
instances fall under the heading of "many types" in this context.
______________________________________________________________________

This email is intended only for the use of the individual(s) to whom it is addressed and may be privileged and confidential.
Unauthorised use or disclosure is prohibited.If you receive This e-mail in error, please advise immediately and delete the original message.
This message may have been altered without your or our knowledge and the sender does not accept any liability for any errors or omissions in the message.



More information about the Python-list mailing list