eval(repr(object)) hardly ever works
Matthew Wilson
matt at tplus1.com
Wed Sep 13 11:02:57 EDT 2006
On Wed 13 Sep 2006 10:38:03 AM EDT, Steve Holden wrote:
> That's intentional. Would you have it return the code of all the methods
> when you take the repr() of a class?
I don't think that would be required. Couldn't you return a string with
a call to the constructor inside? That's what sets.Set seems to do:
In [510]: from sets import Set
In [511]: s = Set()
In [512]: s.add('baloney')
In [513]: repr(s)
Out[513]: "Set(['baloney'])"
In [514]: eval(repr(s))
Out[514]: Set(['baloney'])
> regards
> Steve
PS: I read your python web programming book a few years ago.
--
A better way of running series of SAS programs:
http://overlook.homelinux.net/wilsonwiki/SasAndMakefiles
More information about the Python-list
mailing list