eval(repr(x)) == x

François Pinard pinard at iro.umontreal.ca
Sun Jan 27 14:50:09 CET 2002


[François Pinard]

> I wonder if `repr' could not be made to produce a string which includes
> a non-binary pickle of a complex object, combined with a modification to
> the standard Python reading device understanding the convention, and able
> to recreate the original from the pickle data in the string.

[Alex Martelli]

> I think it's more important for repr(x) to identify x reasonably well
> (compatibly with not taking up a thousand characters:-) rather than
> striving for repr to be eval's inverse [...]

Yes, it traversed my mind that `repr' of a complex object, containing
a representation of it, could use a lot of characters, maybe enough to
kill legibility.  I was probably hoping a miracle :-).  Some happen!

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list