<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
I was just reading about the new file.newlines method that was added
per PEP 278.  I suspect Guido must have been looking in some other
direction when this got added, because it seems unlikely to me that he
would have let this get by...  Okay, maybe I'm being a little harsh <span
 class="moz-smiley-s1"><span> :-)   </span></span> Sorry, I'm picky
about this kind of thing.  The again, maybe I'm just missing some key
point.<br>
<blockquote>
  <div class="yui-g">
  <h1 class="maintitle">file.newlines</h1>
  </div>
  <div class="yui-u first">
  <p><strong>newlines</strong></p>
  <p>If Python was built with the <strong>—with-universal-newlines</strong>
option to
  <strong>configure</strong> (the default) this read-only attribute
exists, and for
files opened in universal newline read mode it keeps track of the
types of newlines encountered while reading the file. The values it
can take are <code>'\r'</code>, <code>'\n'</code>, <code>'\r\n'</code>,
  <a href="http://effbot.org/pyref/None.htm"><strong>None</strong></a>
(unknown, no newlines
read yet) or a tuple containing all the newline types seen, to
indicate that multiple newline conventions were encountered. For files
not opened in universal newline read mode the value of this attribute
will be <a href="http://effbot.org/pyref/None.htm"><strong>None</strong></a>.</p>
  </div>
</blockquote>
<!-- yui-g --><br>
It seems immediately obvious to me that the return value should always
be a tuple, consisting of zero or more strings.  If built with
universal newlines, it should return ('\n',) if a newline was found.<br>
<br>
Perhaps there was some blurry contemplation that the None return value
could identify that <strong>universal-newlines</strong> is enabled,
but this is blurry because None could also just mean that no newlines
have been read.  Besides, it's not a good idea to stuff extra semantics
like that.  Better would be a separate way to identify <strong>universal-newlines
</strong>mode.<br>
<br>
Ken Seehart<br>
<br>
<br>
</body>
</html>