"Nick Maclaren" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| The question is independent of what the outside system believes a
| text file should look like, and is solely what Python believes a
| sequence of characters should mean.  For example, does 'A\r\nB'
| mean that B is separated from A by one newline or two?

The grammar presupposes that Python code is divided into lines.  Any 
successful interpreter must adjust to the external source's idea of line 
endings.  This is implementation, not language definition.

The grammar itself has no notion of structure within Python string objects. 
The split method lets one define anything as chunk separators.

The builtin compile method that uses strings as code input specifies \n and 
only \n as a line ending.  The universal line-ending model of string output 
to files does the same.  So from either viewpoint, the unambiguous answer 
to your question is 'one'.

Terry Jan Reedy



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to