[Python-Dev] Re: Multibyte repr()

Guido van Rossum guido@python.org
Thu, 10 Oct 2002 14:52:02 -0400


> > > I realized that string_repr's depending on locale can be a problem
> > > maker for many unexpected situations. What I wanted in this patch is
> > > just to see _real_ string even in lists or dictionaries.
> > > I and CJKV users may feel happy even without string_repr locale patch.
> > 
> > I'm not sure I follow.  What is the alternative that you propose?
> 
> I think Hye-Shik Chang would be happy if just tp_print acts according
> to the locale, and "most" containers support tp_print. Given that
> list, tuple, and dict have tp_print, no further action might be
> needed.

That should not be done.  tp_print only gets invoked when sys.stdout
is a real file; otherwise str() or repr() gets invoked.  This should
be transparent; tp_print should be an optimization only, not a way to
get different semantics.  It has already been mentioned that tp_print
is not invoked when using print from IDLE.

> I'm now convinced that having repr locale-specific is unacceptable. So
> I would back something out. However, I still sympathize with the
> original rationale, and I don't see a problem with tp_print differing
> from tp_repr.

I do, see above.  Feel free to back out the multibyte-string patches.
We have learned something.

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