[Python-3000] Recursive str

atsuo ishimoto ishimoto at gembook.org
Mon Apr 14 12:33:49 CEST 2008


2008/4/13, Greg Ewing <greg.ewing at canterbury.ac.nz>:
>  I'm not sure what to do about that, though. Maybe some
>  sort of locale setting that makes repr() of a string not
>  escape chars that fall into some kind of "normal" set
>  according to the user's native language?
>

Here's my idea.

repr() cannot convert 'unprintable characters', since repr() doesn't know
which characters are printable or not.

So, repr() should convert only non-printable "ASCII" characters and
special "ASCII" characters such as '\n". Other non-ASCII characters are
converted by output file. Output files can convert non-printable
characters to \uXXXX. Such conversions could be implemented by
backslashreplace error handler.

I wrote a quick patch. Please take a look at http://bugs.python.org/issue2630 .


More information about the Python-3000 mailing list