[Python-Dev] [Python-3000] Universal newlines support in Python 3.0
p.f.moore at gmail.com
Sun Aug 12 21:12:29 CEST 2007
On 12/08/07, Georg Brandl <g.brandl at gmx.net> wrote:
> Note that Python does nothing special in the above case. For non-Windows
> platforms, you'd get two different results -- the conversion from \r\n to
> \n is done by the Windows C runtime since the default open() mode is text mode.
> Only with mode 'U' does Python use its own universal newline mode.
Pah. You're right - I almost used 'U' and then "discovered" that I
didn't need it (and got bitten by a portability bug as a result :-()
> With Python 3.0, the C library is not used and Python uses universal newline
> mode by default.
That's what I expected, but I was surprised to find that the PEP is
pretty unclear on this. The phrase "universal newlines" is mentioned
only once, and never defined. Knowing the meaning, I can see how the
PEP is intended to say that universal newlines on input is the default
(and you set the newline argument to specify a *specific*,
non-universal, newline value) - but I missed it on first reading.
Thanks for the clarification.
More information about the Python-Dev