Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> I believe the recommendation for eval(repr(obj)) to give obj again is
> meant as a convenience for the interactive interpreter, and even there
> only for simple types like int or list.
and even with types as simple as list and int the round tripping can easily
fail:
>>> lst = [1, 2, 3]
>>> lst[1] = lst
>>> eval(repr(lst))
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
eval(repr(lst))
File "<string>", line 1
[1, [...], 3]
^
SyntaxError: invalid syntax
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list