Python 2.7.5: Strange and differing behavior depending on sys.setdefaultencoding being set

Chris Angelico rosuav at
Wed Dec 4 01:20:40 CET 2013

On Wed, Dec 4, 2013 at 11:15 AM, Hans-Peter Jansen <hpj at> wrote:
> Given the amount of special unicode handling code, that is necessary to keep
> Python 2 happy, makes proceeding with it no real fun on a longer term..
> And the biggest proponent for hacking in Python IS the fun part of it. Then
> productivity, elegance, ..., you name it.

Yeah. I think Py2 is improved significantly by turning it as much as
possible into Py3 (which means, in this case, unicode_literals and
then basically working everywhere with Unicode), but of course, that
sometimes just moves the breakage - as you found here, with repr()
insisting on returning a str. The breakage created by Py3 is so worth
taking, it's just a matter of when you move.


More information about the Python-list mailing list