[Python-3000] Recursive str
Guido van Rossum
guido at python.org
Fri Apr 11 15:57:47 CEST 2008
On Fri, Apr 11, 2008 at 5:55 AM, Oleg Broytmann <phd at phd.pp.ru> wrote:
> str([a, b, c]) currently does a wrong thing if items are non-ascii
> strings - calling repr() on them produces '\XXX' escapes instead of
> a readable representation.
But merely calling str() on the items instead of repr() isn't good
enough here: we don't want str(['1, 2']) to return '[1, 2]'. 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.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list