[PYTHONMAC-SIG] UNIX files
Guido van Rossum
guido@CNRI.Reston.Va.US
Thu, 10 Oct 1996 10:49:09 -0400
> I was originally thinking about a solution in this vein, but I think that it
> is better to give an error. The problem with such an "accept everything"
> approach is that it will cause confusion in another place: when you open a
> unix textfile in your python program.
Hmm... This is really a problem with the CW stdio library -- it
appears to *swap* CR and LF in text translation mode. If it just
mapped CR to LF and left LF alone, we'd have no problems (until
someone tries a DOS file, which will appear to be double-spaced).
> My suggestion would be to make \r be illegal to the parser. There is
> currently code in tokenizer.c that explicitly turns \r into \n, if
> this were disabled (and a decent error message was given, such as
> "SyntaxError, \r in line (non-native text file?)" this problem would
> easily be catched.
The only code I can find turns CR LF into LF, which would be fine to
convert DOS files when read in binary mode.
--Guido van Rossum (home page: http://www.python.org/~guido/)
=================
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
=================