[issue5876] __repr__ returning unicode doesn't work when called implicitly

Armin Rigo report at bugs.python.org
Tue Sep 6 18:56:41 CEST 2011


Armin Rigo <arigo at users.sourceforge.net> added the comment:

A __repr__() that returns unicode can, in CPython 2.7 be used in  "%s" % x  or in  u"%s" % x  --- both expressions then return a unicode without doing any encoding --- but it cannot be used anywhere else, e.g. in  "%r" % x  or in  repr(x).  See also the PyPy issue https://bugs.pypy.org/issue857 .

----------
nosy: +arigo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5876>
_______________________________________


More information about the Python-bugs-list mailing list