summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-07-29 21:05:35 (GMT)
committerGuido van Rossum <guido@python.org>1998-07-29 21:05:35 (GMT)
commit5fdd119abafacd11c6329d77b6cb6f032e08ea2d (patch)
tree39ebcae19e93d1fd1d92fba77e0fdb4e9ceeedbb
parentb35631587b89af135de665f5417cd84edd27aeb2 (diff)
downloadcpython-5fdd119abafacd11c6329d77b6cb6f032e08ea2d.zip
cpython-5fdd119abafacd11c6329d77b6cb6f032e08ea2d.tar.gz
cpython-5fdd119abafacd11c6329d77b6cb6f032e08ea2d.tar.bz2
Clarify the + and b mode characters for open() a bit.
-rw-r--r--Doc/lib/libfuncs.tex14
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index f00d81d..bc121c1 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -392,12 +392,14 @@ any kind of sequence; the result is always a list.
\code{'a'} opens it for appending (which on \emph{some} \UNIX{}
systems means that \emph{all} writes append to the end of the file,
regardless of the current seek position).
- Modes \code{'r+'}, \code{'w+'} and
- \code{'a+'} open the file for updating, provided the underlying
- \code{stdio} library understands this. On systems that differentiate
- between binary and text files, \code{'b'} appended to the mode opens
- the file in binary mode. If the file cannot be opened,
- \exception{IOError} is raised.
+
+ Modes \code{'r+'}, \code{'w+'} and \code{'a+'} open the file for
+ updating (note that \code{'w+'} truncates the file). Append
+ \code{'b'} to the mode to open the file in binary mode, on systems
+ that differentiate between binary and text files (else it is
+ ignored). If the file cannot be opened, \exception{IOError} is
+ raised.
+
If \var{mode} is omitted, it defaults to \code{'r'}.
The optional \var{bufsize} argument specifies the file's desired
buffer size: 0 means unbuffered, 1 means line buffered, any other