[Python-Dev] End of the line

Guido van Rossum guido@CNRI.Reston.VA.US
Tue, 13 Jul 1999 08:53:52 -0400

> The latest versions of the Icon language (9.3.1 & beyond) sprouted an
> interesting change in semantics:  if you open a file for reading in
> "translated" (text) mode now, it normalizes Unix, Mac and Windows line
> endings to plain \n.  Writing in text mode still produces what's natural for
> the platform.
> Anyone think that's *not* a good idea?

I've been thinking about this myself -- exactly what I would do.

Not clear how easy it is to implement (given that I'm not so enthused
about the idea of rewriting the entire I/O system without using stdio
-- see archives).

The implementation must be as fast as the current one -- people used
to complain bitterly when readlines() or read() where just a tad
slower than they *could* be.

There's a lookahead of 1 character needed -- ungetc() might be
sufficient except that I think it's not guaranteed to work on
unbuffered files.

Should also do this for the Python parser -- there it would be a lot

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