diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-08-03 22:55:38 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-08-03 22:55:38 (GMT) |
commit | 0c1c0d42dcc8fc223eb3aaa51d09d252b1738820 (patch) | |
tree | a0a45ec295b8fd4564d6537d457daf1b97f96c5d /Modules/_io | |
parent | 676e73b3fb312f2b4ba413090bf930f6ad8690cb (diff) | |
download | cpython-0c1c0d42dcc8fc223eb3aaa51d09d252b1738820.zip cpython-0c1c0d42dcc8fc223eb3aaa51d09d252b1738820.tar.gz cpython-0c1c0d42dcc8fc223eb3aaa51d09d252b1738820.tar.bz2 |
Make TextIOWrapper's documentation clearer by copying the newline argument's description from open().
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/textio.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index d86a1c7..518108b 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -622,15 +622,22 @@ PyDoc_STRVAR(textiowrapper_doc, "errors determines the strictness of encoding and decoding (see the\n" "codecs.register) and defaults to \"strict\".\n" "\n" - "newline can be None, '', '\\n', '\\r', or '\\r\\n'. It controls the\n" - "handling of line endings. If it is None, universal newlines is\n" - "enabled. With this enabled, on input, the lines endings '\\n', '\\r',\n" - "or '\\r\\n' are translated to '\\n' before being returned to the\n" - "caller. Conversely, on output, '\\n' is translated to the system\n" - "default line separator, os.linesep. If newline is any other of its\n" - "legal values, that newline becomes the newline when the file is read\n" - "and it is returned untranslated. On output, '\\n' is converted to the\n" - "newline.\n" + "newline controls how line endings are handled. It can be None, '',\n" + "'\\n', '\\r', and '\\r\\n'. It works as follows:\n" + "\n" + "* On input, if newline is None, universal newlines mode is\n" + " enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n" + " these are translated into '\\n' before being returned to the\n" + " caller. If it is '', universal newline mode is enabled, but line\n" + " endings are returned to the caller untranslated. If it has any of\n" + " the other legal values, input lines are only terminated by the given\n" + " string, and the line ending is returned to the caller untranslated.\n" + "\n" + "* On output, if newline is None, any '\\n' characters written are\n" + " translated to the system default line separator, os.linesep. If\n" + " newline is '', no translation takes place. If newline is any of the\n" + " other legal values, any '\\n' characters written are translated to\n" + " the given string.\n" "\n" "If line_buffering is True, a call to flush is implied when a call to\n" "write contains a newline character." |