[Python-3000] Recursive str

Guido van Rossum guido at python.org
Mon Apr 14 20:05:45 CEST 2008


On Sat, Apr 12, 2008 at 5:17 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>  > We'd
>  > need a third form (eek!) that would preserve the string quotes but be
>  > more lenient about non-ASCII. Personally, I think some custom loop to
>  > print the values is good enough.
>
>  It might not be a serious problem when most of the chars in
>  the string are ascii, but what about e.g. a Japanese user
>  whose strings consist almost entirely of non-ascii, but are
>  for the most part what constitutes perfectly readable text
>  to them? They will have no straightforward way to display
>  a list of strings in a readable form.

A complaint about this would carry more weight when it came from
someone who actually has to deal with the issue than coming from a
purely theoretical perspective (unless I'm wrong and you actually read
Japanese).

Another issue is that repr() is supposed to return an 8-bit string. I
don't think we should put non-ASCII characters in the output in some
encoding.

>  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?

That would be worse. Making repr() non-predictable and locale-specific? Eeeek!

In Py3k we may be able to do something else though -- instead of
insisting on ASCII we could allow a much larger set of characters to
be unescaped.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list