Python 3.0 crashes displaying Unicode at interactive prompt

"Martin v. Löwis" martin at v.loewis.de
Sat Dec 13 23:46:58 EST 2008


> "Sure" as in "sure, it was not intended behaviour"?

It was intended behavior, and still is in 3.0.

>> This behavior has not changed. It still uses repr().
>>
>> Of course, the string type has changed in 3.0, and now uses a different
>> definition of repr.
> 
> So was the above-reported non-crash consequence of the change of
> definition of repr intended?

Yes. If you want a display that is guaranteed to work on your terminal,
use the ascii() builtin function.

py> x = '\u9876'
py> ascii(x)
"'\\u9876'"
py> print(ascii(x))
'\u9876'

Regards,
Martin



More information about the Python-list mailing list