[Python-Dev] Next version of PEP278 - universal newline support - available

Finn Bock bckfnn@worldonline.dk
Thu, 14 Mar 2002 16:51:57 GMT


[Jack Jansen]

>Folks,
>the next version of PEP278, universal newline support, and the 
>accompanying patch are available for your review and testing.
>
>The patch has changed very little:
>- open(filename, 'U') is now the way to open files for universal 
>newline reading because 't' may have a use on Windows;
>- --with-universal-newlines is now the default configure option.
>
>The PEP has changed a bit more, mainly addressing issues brought 
>up by Guido and Greg Ward.
>
>Please read, test and comment,

The patch univnewlines-20020313 appears to be a plain diff, and for some
reason, it doesn't apply cleanly for me, so I may be reading the patch
wrongly.

The PEP seems to assume that the changed behaviour only apply to
.readline() and friends. I'm sure that is obvious to you, but for
historical reasons beyound my control, the universal newline support in
jython normalize all lineendings to a newline for all reads on text
files. I think jython is wrong here and your PEP is better. I just think
the PEP could be a little more specific and say that the newline support
only influence readline() and tell() and not read().

Is it really necessary to handle lineendings in tell()? What would be
lost if skipnextlf was ignored in file_tell()?

And IMHO, the 'U' flag should be the default.

regards,
finn