[Python-ideas] Replacing the standard IO streams (was Re: changing sys.stdout encoding)
p.f.moore at gmail.com
Mon Jun 11 10:06:42 CEST 2012
On 11 June 2012 07:16, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> MRAB writes:
> > That's actually Python 3.1. From Python 3.2 it's slightly different,
> > but still not quite right:
> > Python 3.1: "hello\r\nhello\r\r\n"
> > Python 3.2: "hello\nhello\r\n"
> > Python 3.3.0a4: "hello\nhello\r\n"
> > All on Windows.
> <stifle o="self"/>
> Hm. Maybe it's that port's implementation of universal newlines or
> something like that? What happens if you use an explicit "end="
> argument? (I don't have a Python 3 to check on Windows easily
Explicit end= makes no difference to the behaviour. In fact, a minimal
test suggests that universal newline mode is not enabled on Windows in
Python 3. That's a regression from 2.x. See below.
D:\Data>py -3 -c "print('x')" | od -c
0000000 x \n
D:\Data>py -2 -c "print('x')" | od -c
0000000 x \r \n
D:\Data>py -3 -V
D:\Data>py -2 -V
More information about the Python-ideas