[Python-3000] Fwd: UPDATED: PEP 3138- String representation in Python 3000

Adam Olsen rhamph at gmail.com
Sat May 31 23:33:05 CEST 2008


On Sat, May 31, 2008 at 11:30 AM, Atsuo Ishimoto <ishimoto at gembook.org> wrote:
> On Sun, Jun 1, 2008 at 1:32 AM, Guido van Rossum <guido at python.org> wrote:
>> - I'm still not comfortable with making stdout default to
>> backslashreplace. Stuff written to stdout might be consumed by another
>> program that might misinterpret the \ escapes. Previously I thought I
>> was okay with doing this only if stdout.isatty() returns True, but I
>> think that would just add confusion of the kind "it works in
>> interactive mode but not when redirecting to a file".  I'm okay with
>> apps who think they need this setting that explicitly, but not to
>> having it be the default. (For stderr however I agree that
>> backslashreplace is the right default.)
>
> Okay, we'll keep 'strict' as default error handler for stdout always,
> then. I can live with it.
> But, my $0.02, I expect this issue will be revisited after people
> start to develop real applications with Python 3.x.

I think the reason why strict/backslashreplace (respectively) work
well is that you can print a unicode string to stdout, have it fail
(encoding can't handle it), then get an exception printed to stderr
with the string escaped.

Making stderr stricter would make it unable to print the string and
making stdout less strict would let the error pass silently (printing
potential garbage instead).

-- 
Adam Olsen, aka Rhamphoryncus


More information about the Python-3000 mailing list