Best output type and encoding practices for __repr__() functions?
Lately, I've had lots of trouble with __repr__() , format() , and encodings. Should the output of __repr__() be encoded or be a unicode string? Is there a best encoding for the result of __repr__() in Python? What I want to output does have non-ASCII characters. I use Python 2.x, and want to write code that can easily be adapted to Python 3. The program thus uses # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function # The 'Hello' literal represents a Unicode object Here are some additional problems that have been bothering me, and I'm looking for a solution that