[Python-Dev] str() vs. unicode()
Walter Dörwald
walter@livinglogic.de
Wed, 26 Sep 2001 19:11:00 +0200
Guido van Rossum wrote:
>[...]
>
>>BTW, what about __repr__? Should this be allowed to return unicode
>>objects? (currently it is, and uses PyUnicode_AsUnicodeEscapeString)
>>
>
> But this is rarely what the caller expects, and it violates the
> guideline that repr() should return something that can be fed back to
> the parser.
I'd say this is a bug in the parser! >;)
> I'd rather change the rules to require that __repr__ and
> tp_repr return an 8-bit string at all times.
Sounds reasonable and again makes the implementation simpler
(as long as we're not in an all unicode world).
Bye,
Walter Dörwald