[Python-3000] PEP 3138- String representation in Python 3000

Greg Ewing greg.ewing at canterbury.ac.nz
Wed May 28 02:25:50 CEST 2008


M.-A. Lemburg wrote:

> AFAIK, eval(repr(obj)) is no longer a requirement... simply because
> it has always only worked for a small subset of objects and in
> reality, you wouldn't want to call eval() on anything too often
> due to the security implications.

Yes, I actually think that sentence in the docs should
be removed, since it's more misleading than helpful.

A suitable replacement might be something like "str()
is intended for normal program output, and repr() is
intended for diagnostic output". Plus something about
it being desirable for repr() to make the type of the
object as unambiguous as possible.

-- 
Greg


More information about the Python-3000 mailing list