[Python-Dev] New lines, carriage returns, and Windows

Guido van Rossum guido at python.org
Thu Sep 27 19:35:18 CEST 2007


[moving to python-3000]

The symmetry isn't as strong as you suggest, but I agree it would be a
useful feature. Would you mind filing a Py3k feature request so we
don't forget?

A proposal for an API given the existing newlines=... parameter
(described in detail in PEP 3116) would be even better.

And a patch would be best, but you know that. :-)

--Guido

On 9/26/07, skip at pobox.com <skip at pobox.com> wrote:
>
>     Greg> Maybe there should be a universal newlines mode defined for output
>     Greg> as well as input, which translates any of "\r", "\n" or "\r\n"
>     Greg> into the platform line ending.
>
> I thought that's the way it was supposed to work, but it clearly doesn't:
>
>     >>> f = open("test.txt", "wt")
>     >>> f.write("a\rb\rnc\n")
>     7
>     >>> f.close()
>     >>> open("test.txt", "rb").read()
>     b'a\rb\rnc\n'
>
> I'd be open to such a change.  Principle of least surprise?
>
> Skip
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


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


More information about the Python-Dev mailing list