Python 3.0 and repr
"Martin v. Löwis"
martin at v.loewis.de
Sun Sep 28 23:47:00 CEST 2008
> What are others' opinions? Any insight to this design decision?
The intention is that all printable characters in a string get displayed
in repr. This was in particular requested by Japanese users (but also by
other users of non-ASCII characters) which complained that repr() is
fairly useless if your strings actually contains *no* ASCII characters
(but all of them are printable).
Notice that repr() of the string actually succeeds; try
It is the printing of the repr that fails.
> Maybe repr() should always display the ASCII representation with
> escapes for all other characters
You can use the ascii() builtin if you want that.
> especially considering the "repr() should produce output suitable for
> eval() when possible" rule.
But that is preserved under the new behavior, also! Just try
P.S. How did you manage to get U+5000 into your data, on a system where
the terminal encoding is cp437? Google translates it as "Rash"; the
Unihan database also has "bewildered", "wildly".
More information about the Python-list