Change when lines are translated on input (only if newline=None),

and clarify language around translation.
Also remark that SocketIO lives in the socket module, and drop
reference to MemIO.
This commit is contained in:
Guido van Rossum 2007-08-18 21:17:04 +00:00
parent 26f94580ca
commit ae09ad1797
1 changed files with 9 additions and 6 deletions

View File

@ -131,10 +131,10 @@ about this).
Returns the underlying file descriptor (an integer)
Initially, three implementations will be provided that implement the
``RawIOBase`` interface: ``FileIO``, ``SocketIO``, and ``ByteIO``
(also ``MMapIO``?). Each implementation must determine whether the
object supports random access as the information provided by the user
may not be sufficient (consider ``open("/dev/tty", "rw")`` or
``RawIOBase`` interface: ``FileIO``, ``SocketIO`` (in the socket
module), and ``ByteIO``. Each implementation must determine whether
the object supports random access as the information provided by the
user may not be sufficient (consider ``open("/dev/tty", "rw")`` or
``open("/tmp/named-pipe", "rw")``). As an example, ``FileIO`` can
determine this by calling the ``seek()`` system call; if it returns an
error, the object does not support random access. Each implementation
@ -361,14 +361,17 @@ signature:
are returned to the caller untranslated. If it has any of
the other legal values, input lines are only terminated by
the given string, and the line ending is returned to the
caller translated to ``'\n'``.
caller untranslated. (In other words, translation to
``'\n'`` only occurs if ``newline`` is ``None``.)
* On output, if ``newline`` is ``None``, any ``'\n'``
characters written are translated to the system default
line separator, ``os.linesep``. If ``newline`` is ``''``,
no translation takes place. If ``newline`` is any of the
other legal values, any ``'\n'`` characters written are
translated to the given string.
translated to the given string. (Note that the rules
guiding translation are different for output than for
input.)
Further notes on the ``newline`` parameter: