eval(repr(x)) == x

François Pinard pinard at iro.umontreal.ca
Sun Jan 27 08:33:28 EST 2002


[Oren Tirosh]

> For many python builtins eval(repr(x)) == x.  I find this property very
> useful for debugging and writing tests.  Is there anyone else who thinks
> it might be more consistent if this applied to more builtins?

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.

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




More information about the Python-list mailing list