Commit 01be9fc2 authored by Fred Drake's avatar Fred Drake

Document that the |mode| parameter to open() is optional and explain how

the default value is determined.
parent 6384f9c2
...@@ -33,15 +33,16 @@ second's worth occupies 2*2*44100 bytes, i.e.\ 176,400 bytes. ...@@ -33,15 +33,16 @@ second's worth occupies 2*2*44100 bytes, i.e.\ 176,400 bytes.
Module \module{aifc} defines the following function: Module \module{aifc} defines the following function:
\begin{funcdesc}{open}{file, mode} \begin{funcdesc}{open}{file\optional{, mode}}
Open an AIFF or AIFF-C file and return an object instance with Open an AIFF or AIFF-C file and return an object instance with
methods that are described below. The argument file is either a methods that are described below. The argument \var{file} is either a
string naming a file or a file object. The mode is either the string string naming a file or a file object. \var{mode} must be \code{'r'}
\code{'r'} when the file must be opened for reading, or \code{'w'} or \code{'rb'} when the file must be opened for reading, or \code{'w'}
when the file must be opened for writing. When used for writing, the or \code{'wb'} when the file must be opened for writing. If omitted,
file object should be seekable, unless you know ahead of time how many \code{\var{file}.mode} is used if it exists, otherwise \code{'rb'} is
samples you are going to write in total and use used. When used for writing, the file object should be seekable,
\method{writeframesraw()} and \method{setnframes()}. unless you know ahead of time how many samples you are going to write
in total and use \method{writeframesraw()} and \method{setnframes()}.
\end{funcdesc} \end{funcdesc}
Objects returned by \function{open()} when a file is opened for Objects returned by \function{open()} when a file is opened for
......
...@@ -12,7 +12,7 @@ mono/stereo. ...@@ -12,7 +12,7 @@ mono/stereo.
The \module{wave} module defines the following function and exception: The \module{wave} module defines the following function and exception:
\begin{funcdesc}{open}{file, mode} \begin{funcdesc}{open}{file\optional{, mode}}
If \var{file} is a string, open the file by that name, other treat it If \var{file} is a string, open the file by that name, other treat it
as a seekable file-like object. \var{mode} can be any of as a seekable file-like object. \var{mode} can be any of
\begin{description} \begin{description}
...@@ -23,7 +23,10 @@ Note that it does not allow read/write WAV files. ...@@ -23,7 +23,10 @@ Note that it does not allow read/write WAV files.
A \var{mode} of \code{'r'} or \code{'rb'} returns a \class{Wave_read} A \var{mode} of \code{'r'} or \code{'rb'} returns a \class{Wave_read}
object, while a \var{mode} of \code{'w'} or \code{'wb'} returns object, while a \var{mode} of \code{'w'} or \code{'wb'} returns
a \class{Wave_write} object. a \class{Wave_write} object. If \var{mode} is omitted and a file-like
object is passed as \var{file}, \code{\var{file}.mode} is used as the
default value for \var{mode} (the \character{b} flag is still added if
necessary).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{openfp}{file, mode} \begin{funcdesc}{openfp}{file, mode}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment