[OT] Re: are there some special about '\x1a' symbol

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jan 14 09:06:11 CET 2009

En Tue, 13 Jan 2009 22:04:33 -0200, Terry Reedy <tjreedy at udel.edu>  

> Gabriel Genellina wrote:
>> En Mon, 12 Jan 2009 12:00:16 -0200, John Machin <sjmachin at lexicon.net>  
>> escribió:
>>> I didn't think your question was stupid. Stupid was (a) CP/M recording
>>> file size as number of 128-byte sectors, forcing the use of an in-band
>>> EOF marker for text files (b) MS continuing to regard Ctrl-Z as an EOF
>>> decades after people stopped writing Ctrl-Z at the end of text files.
>>  This is called "backwards compatibility" and it's a good thing :)
> But it does not have to be the default or only behavior to be available.

Sure. And it isn't - there are many flags to open and fopen to choose  
The C89 standard (the language used to compile CPython) guarantees *only*  
that printable characters, tab, and newline are preserved in a text file;  
everything else may or may not appear when it is read again. Even  
whitespace at the end of a line may be dropped. Binary files are more  

Delphi recognizes the EOF marker when reading a text file only inside the  
file's last 128-byte block -- this mimics the original CP/M behavior  
rather closely. I thought the MSC runtime did the same, but no, the EOF  
marker is recognized anywhere. And Python inherits that (at least in 2.6  
-- I've not tested with 3.0)

Gabriel Genellina

More information about the Python-list mailing list