[Python-3000] Universal newlines support in Python 3.0
Stephen J. Turnbull
stephen at xemacs.org
Sat Aug 11 09:02:07 CEST 2007
Greg Ewing writes:
> Guido van Rossum wrote:
> > However, the old universal newlines feature also set an attibute named
> > 'newlines' on the file object to a tuple of up to three elements
> > giving the actual line endings that were observed on the file so far
> > (\r, \n, or \r\n).
>
> I've never used it, but I can see how it could be
> useful, e.g. if you're implementing a text editor
> that wants to be able to save the file back in
> the same format it had before.
But if there's more than one line ending used, that's not good
enough. Universal newlines is a wonderful convenience for most text
usage, but if you really need to be able to preserve format, it's not
going to be enough.
I think it's best for universal newlines to be simple. Let fancy
facilities be provided by a library wrapping raw IO, as you suggest.
More information about the Python-3000
mailing list