Commit 2ea7f2ed authored by Fred Drake's avatar Fred Drake

Several minor markup nits.

parent 4c85328c
...@@ -145,8 +145,8 @@ Again, such objects are ordered arbitrarily but consistently. ...@@ -145,8 +145,8 @@ Again, such objects are ordered arbitrarily but consistently.
ordered by their type names; objects of the same types that don't ordered by their type names; objects of the same types that don't
support proper comparison are ordered by their address.) support proper comparison are ordered by their address.)
Two more operations with the same syntactic priority, \code{in} and Two more operations with the same syntactic priority, \samp{in} and
\code{not in}, are supported only by sequence types (below). \samp{not in}, are supported only by sequence types (below).
\opindex{in} \opindex{in}
\opindex{not in} \opindex{not in}
...@@ -172,7 +172,7 @@ working with. ...@@ -172,7 +172,7 @@ working with.
Complex numbers have a real and imaginary part, which are both Complex numbers have a real and imaginary part, which are both
implemented using \code{double} in \C{}. To extract these parts from implemented using \code{double} in \C{}. To extract these parts from
a complex number \code{z}, use \code{z.real} and \code{z.imag}. a complex number \var{z}, use \code{\var{z}.real} and \code{\var{z}.imag}.
Numbers are created by numeric literals or as the result of built-in Numbers are created by numeric literals or as the result of built-in
functions and operators. Unadorned integer literals (including hex functions and operators. Unadorned integer literals (including hex
...@@ -230,7 +230,7 @@ comparison operations): ...@@ -230,7 +230,7 @@ comparison operations):
\lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{} \lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{}
\lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)} \lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)}
\lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{} \lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{}
\lineiii{\var{x}**\var{y}}{\var{x} to the power \var{y}}{} \lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{}
\end{tableiii} \end{tableiii}
\indexiii{operations on}{numeric}{types} \indexiii{operations on}{numeric}{types}
...@@ -400,10 +400,12 @@ required by the format string; if the string requires a single ...@@ -400,10 +400,12 @@ required by the format string; if the string requires a single
argument, the right argument may also be a single non-tuple object.% argument, the right argument may also be a single non-tuple object.%
\footnote{A tuple object in this case should be a singleton.} \footnote{A tuple object in this case should be a singleton.}
The following format characters are understood: The following format characters are understood:
\%, c, s, i, d, u, o, x, X, e, E, f, g, G. \code{\%}, \code{c}, \code{s}, \code{i}, \code{d}, \code{u}, \code{o},
Width and precision may be a * to specify that an integer argument \code{x}, \code{X}, \code{e}, \code{E}, \code{f}, \code{g}, \code{G}.
specifies the actual width or precision. The flag characters -, +, Width and precision may be a \code{*} to specify that an integer argument
blank, \# and 0 are understood. The size specifiers h, l or L may be specifies the actual width or precision. The flag characters
\code{-}, \code{+}, blank, \code{\#} and \code{0} are understood. The
size specifiers \code{h}, \code{l} or \code{L} may be
present but are ignored. The \code{\%s} conversion takes any Python present but are ignored. The \code{\%s} conversion takes any Python
object and converts it to a string using \code{str()} before object and converts it to a string using \code{str()} before
formatting it. The ANSI features \code{\%p} and \code{\%n} formatting it. The ANSI features \code{\%p} and \code{\%n}
...@@ -431,10 +433,9 @@ For example: ...@@ -431,10 +433,9 @@ For example:
>>> language = 'Python' >>> language = 'Python'
>>> print '%(language)s has %(count)03d quote types.' % vars() >>> print '%(language)s has %(count)03d quote types.' % vars()
Python has 002 quote types. Python has 002 quote types.
>>>
\end{verbatim} \end{verbatim}
In this case no * specifiers may occur in a format (since they In this case no \code{*} specifiers may occur in a format (since they
require a sequential parameter list). require a sequential parameter list).
Additional string operations are defined in standard module Additional string operations are defined in standard module
...@@ -553,7 +554,7 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object): ...@@ -553,7 +554,7 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object):
\lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)}
\lineiii{\var{a}.update(\var{b})}{\code{for k, v in \var{b}.items(): \var{a}[k] = v}}{(3)} \lineiii{\var{a}.update(\var{b})}{\code{for k, v in \var{b}.items(): \var{a}[k] = v}}{(3)}
\lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)}
\lineiii{\var{a}.get(\var{k}, \var{f})}{the item of \var{a} with key \var{k}}{(4)} \lineiii{\var{a}.get(\var{k}\optional{, \var{f}})}{the item of \var{a} with key \var{k}}{(4)}
\end{tableiii} \end{tableiii}
\indexiii{operations on}{mapping}{types} \indexiii{operations on}{mapping}{types}
\indexiii{operations on}{dictionary}{type} \indexiii{operations on}{dictionary}{type}
...@@ -587,20 +588,21 @@ Most of these support only one or two operations. ...@@ -587,20 +588,21 @@ Most of these support only one or two operations.
\subsubsection{Modules} \subsubsection{Modules}
The only special operation on a module is attribute access: The only special operation on a module is attribute access:
\code{\var{m}.\var{name}}, where \var{m} is a module and \var{name} accesses \code{\var{m}.\var{name}}, where \var{m} is a module and \var{name}
a name defined in \var{m}'s symbol table. Module attributes can be accesses a name defined in \var{m}'s symbol table. Module attributes
assigned to. (Note that the \code{import} statement is not, strictly can be assigned to. (Note that the \code{import} statement is not,
spoken, an operation on a module object; \code{import \var{foo}} does not strictly spoking, an operation on a module object; \code{import
require a module object named \var{foo} to exist, rather it requires \var{foo}} does not require a module object named \var{foo} to exist,
an (external) \emph{definition} for a module named \var{foo} rather it requires an (external) \emph{definition} for a module named
somewhere.) \var{foo} somewhere.)
A special member of every module is \code{__dict__}. A special member of every module is \code{__dict__}.
This is the dictionary containing the module's symbol table. This is the dictionary containing the module's symbol table.
Modifying this dictionary will actually change the module's symbol Modifying this dictionary will actually change the module's symbol
table, but direct assignment to the \code{__dict__} attribute is not table, but direct assignment to the \code{__dict__} attribute is not
possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which
defines \code{\var{m}.a} to be \code{1}, but you can't write \code{\var{m}.__dict__ = \{\}}. defines \code{\var{m}.a} to be \code{1}, but you can't write
\code{\var{m}.__dict__ = \{\}}.
Modules are written like this: \code{<module 'sys'>}. Modules are written like this: \code{<module 'sys'>}.
...@@ -621,10 +623,12 @@ the function), but the implementation is different, hence the ...@@ -621,10 +623,12 @@ the function), but the implementation is different, hence the
different object types. different object types.
The implementation adds two special read-only attributes: The implementation adds two special read-only attributes:
\code{\var{f}.func_code} is a function's \dfn{code object} (see below) and \code{\var{f}.func_code} is a function's \dfn{code
\code{\var{f}.func_globals} is the dictionary used as the function's object}\obindex{code} (see below) and \code{\var{f}.func_globals} is
global name space (this is the same as \code{\var{m}.__dict__} where the dictionary used as the function's global name space (this is the
\var{m} is the module in which the function \var{f} was defined). same as \code{\var{m}.__dict__} where \var{m} is the module in which
the function \var{f} was defined).
\subsubsection{Methods} \subsubsection{Methods}
\obindex{method} \obindex{method}
...@@ -752,13 +756,13 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends. ...@@ -752,13 +756,13 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
non-negative, it is a maximum byte count (including the trailing non-negative, it is a maximum byte count (including the trailing
newline) and an incomplete line may be returned. newline) and an incomplete line may be returned.
An empty string is returned when \EOF{} is hit An empty string is returned when \EOF{} is hit
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned immediately. Note: unlike \code{stdio}'s \cfunction{fgets()}, the returned
string contains null characters (\code{'\e 0'}) if they occurred in the string contains null characters (\code{'\e 0'}) if they occurred in the
input. input.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{readlines}{\optional{sizehint}} \begin{methoddesc}[file]{readlines}{\optional{sizehint}}
Read until \EOF{} using \code{readline()} and return a list containing Read until \EOF{} using \method{readline()} and return a list containing
the lines thus read. If the optional \var{sizehint} argument is the lines thus read. If the optional \var{sizehint} argument is
present, instead of reading up to \EOF{}, whole lines totalling present, instead of reading up to \EOF{}, whole lines totalling
approximately \var{sizehint} bytes (possibly after rounding up to an approximately \var{sizehint} bytes (possibly after rounding up to an
...@@ -766,7 +770,7 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends. ...@@ -766,7 +770,7 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{seek}{offset, whence} \begin{methoddesc}[file]{seek}{offset, whence}
Set the file's current position, like \code{stdio}'s \code{fseek()}. Set the file's current position, like \code{stdio}'s \cfunction{fseek()}.
The \var{whence} argument is optional and defaults to \code{0} The \var{whence} argument is optional and defaults to \code{0}
(absolute file positioning); other values are \code{1} (seek (absolute file positioning); other values are \code{1} (seek
relative to the current position) and \code{2} (seek relative to the relative to the current position) and \code{2} (seek relative to the
...@@ -774,7 +778,8 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends. ...@@ -774,7 +778,8 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{tell}{} \begin{methoddesc}[file]{tell}{}
Return the file's current position, like \code{stdio}'s \code{ftell()}. Return the file's current position, like \code{stdio}'s
\cfunction{ftell()}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{truncate}{\optional{size}} \begin{methoddesc}[file]{truncate}{\optional{size}}
...@@ -788,13 +793,13 @@ operation). ...@@ -788,13 +793,13 @@ operation).
\begin{methoddesc}[file]{write}{str} \begin{methoddesc}[file]{write}{str}
Write a string to the file. There is no return value. Note: due to Write a string to the file. There is no return value. Note: due to
buffering, the string may not actually show up in the file until buffering, the string may not actually show up in the file until
the \code{flush()} or \code{close()} method is called. the \method{flush()} or \method{close()} method is called.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{writelines}{list} \begin{methoddesc}[file]{writelines}{list}
Write a list of strings to the file. There is no return value. Write a list of strings to the file. There is no return value.
(The name is intended to match \code{readlines}; \code{writelines} (The name is intended to match \method{readlines()};
does not add line separators.) \method{writelines()} does not add line separators.)
\end{methoddesc} \end{methoddesc}
File objects also offer the following attributes: File objects also offer the following attributes:
...@@ -823,9 +828,9 @@ attribute. ...@@ -823,9 +828,9 @@ attribute.
Boolean that indicates whether a space character needs to be printed Boolean that indicates whether a space character needs to be printed
before another value when using the \keyword{print} statement. before another value when using the \keyword{print} statement.
Classes that are trying to simulate a file object should also have a Classes that are trying to simulate a file object should also have a
writable \code{softspace} attribute, which should be initialized to writable \member{softspace} attribute, which should be initialized to
zero. This will be automatic for classes implemented in Python; types zero. This will be automatic for classes implemented in Python; types
implemented in \C{} will have to provide a writable \code{softspace} implemented in \C{} will have to provide a writable \member{softspace}
attribute. attribute.
\end{memberdesc} \end{memberdesc}
......
...@@ -145,8 +145,8 @@ Again, such objects are ordered arbitrarily but consistently. ...@@ -145,8 +145,8 @@ Again, such objects are ordered arbitrarily but consistently.
ordered by their type names; objects of the same types that don't ordered by their type names; objects of the same types that don't
support proper comparison are ordered by their address.) support proper comparison are ordered by their address.)
Two more operations with the same syntactic priority, \code{in} and Two more operations with the same syntactic priority, \samp{in} and
\code{not in}, are supported only by sequence types (below). \samp{not in}, are supported only by sequence types (below).
\opindex{in} \opindex{in}
\opindex{not in} \opindex{not in}
...@@ -172,7 +172,7 @@ working with. ...@@ -172,7 +172,7 @@ working with.
Complex numbers have a real and imaginary part, which are both Complex numbers have a real and imaginary part, which are both
implemented using \code{double} in \C{}. To extract these parts from implemented using \code{double} in \C{}. To extract these parts from
a complex number \code{z}, use \code{z.real} and \code{z.imag}. a complex number \var{z}, use \code{\var{z}.real} and \code{\var{z}.imag}.
Numbers are created by numeric literals or as the result of built-in Numbers are created by numeric literals or as the result of built-in
functions and operators. Unadorned integer literals (including hex functions and operators. Unadorned integer literals (including hex
...@@ -230,7 +230,7 @@ comparison operations): ...@@ -230,7 +230,7 @@ comparison operations):
\lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{} \lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{}
\lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)} \lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)}
\lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{} \lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{}
\lineiii{\var{x}**\var{y}}{\var{x} to the power \var{y}}{} \lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{}
\end{tableiii} \end{tableiii}
\indexiii{operations on}{numeric}{types} \indexiii{operations on}{numeric}{types}
...@@ -400,10 +400,12 @@ required by the format string; if the string requires a single ...@@ -400,10 +400,12 @@ required by the format string; if the string requires a single
argument, the right argument may also be a single non-tuple object.% argument, the right argument may also be a single non-tuple object.%
\footnote{A tuple object in this case should be a singleton.} \footnote{A tuple object in this case should be a singleton.}
The following format characters are understood: The following format characters are understood:
\%, c, s, i, d, u, o, x, X, e, E, f, g, G. \code{\%}, \code{c}, \code{s}, \code{i}, \code{d}, \code{u}, \code{o},
Width and precision may be a * to specify that an integer argument \code{x}, \code{X}, \code{e}, \code{E}, \code{f}, \code{g}, \code{G}.
specifies the actual width or precision. The flag characters -, +, Width and precision may be a \code{*} to specify that an integer argument
blank, \# and 0 are understood. The size specifiers h, l or L may be specifies the actual width or precision. The flag characters
\code{-}, \code{+}, blank, \code{\#} and \code{0} are understood. The
size specifiers \code{h}, \code{l} or \code{L} may be
present but are ignored. The \code{\%s} conversion takes any Python present but are ignored. The \code{\%s} conversion takes any Python
object and converts it to a string using \code{str()} before object and converts it to a string using \code{str()} before
formatting it. The ANSI features \code{\%p} and \code{\%n} formatting it. The ANSI features \code{\%p} and \code{\%n}
...@@ -431,10 +433,9 @@ For example: ...@@ -431,10 +433,9 @@ For example:
>>> language = 'Python' >>> language = 'Python'
>>> print '%(language)s has %(count)03d quote types.' % vars() >>> print '%(language)s has %(count)03d quote types.' % vars()
Python has 002 quote types. Python has 002 quote types.
>>>
\end{verbatim} \end{verbatim}
In this case no * specifiers may occur in a format (since they In this case no \code{*} specifiers may occur in a format (since they
require a sequential parameter list). require a sequential parameter list).
Additional string operations are defined in standard module Additional string operations are defined in standard module
...@@ -553,7 +554,7 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object): ...@@ -553,7 +554,7 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object):
\lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)}
\lineiii{\var{a}.update(\var{b})}{\code{for k, v in \var{b}.items(): \var{a}[k] = v}}{(3)} \lineiii{\var{a}.update(\var{b})}{\code{for k, v in \var{b}.items(): \var{a}[k] = v}}{(3)}
\lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)}
\lineiii{\var{a}.get(\var{k}, \var{f})}{the item of \var{a} with key \var{k}}{(4)} \lineiii{\var{a}.get(\var{k}\optional{, \var{f}})}{the item of \var{a} with key \var{k}}{(4)}
\end{tableiii} \end{tableiii}
\indexiii{operations on}{mapping}{types} \indexiii{operations on}{mapping}{types}
\indexiii{operations on}{dictionary}{type} \indexiii{operations on}{dictionary}{type}
...@@ -587,20 +588,21 @@ Most of these support only one or two operations. ...@@ -587,20 +588,21 @@ Most of these support only one or two operations.
\subsubsection{Modules} \subsubsection{Modules}
The only special operation on a module is attribute access: The only special operation on a module is attribute access:
\code{\var{m}.\var{name}}, where \var{m} is a module and \var{name} accesses \code{\var{m}.\var{name}}, where \var{m} is a module and \var{name}
a name defined in \var{m}'s symbol table. Module attributes can be accesses a name defined in \var{m}'s symbol table. Module attributes
assigned to. (Note that the \code{import} statement is not, strictly can be assigned to. (Note that the \code{import} statement is not,
spoken, an operation on a module object; \code{import \var{foo}} does not strictly spoking, an operation on a module object; \code{import
require a module object named \var{foo} to exist, rather it requires \var{foo}} does not require a module object named \var{foo} to exist,
an (external) \emph{definition} for a module named \var{foo} rather it requires an (external) \emph{definition} for a module named
somewhere.) \var{foo} somewhere.)
A special member of every module is \code{__dict__}. A special member of every module is \code{__dict__}.
This is the dictionary containing the module's symbol table. This is the dictionary containing the module's symbol table.
Modifying this dictionary will actually change the module's symbol Modifying this dictionary will actually change the module's symbol
table, but direct assignment to the \code{__dict__} attribute is not table, but direct assignment to the \code{__dict__} attribute is not
possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which
defines \code{\var{m}.a} to be \code{1}, but you can't write \code{\var{m}.__dict__ = \{\}}. defines \code{\var{m}.a} to be \code{1}, but you can't write
\code{\var{m}.__dict__ = \{\}}.
Modules are written like this: \code{<module 'sys'>}. Modules are written like this: \code{<module 'sys'>}.
...@@ -621,10 +623,12 @@ the function), but the implementation is different, hence the ...@@ -621,10 +623,12 @@ the function), but the implementation is different, hence the
different object types. different object types.
The implementation adds two special read-only attributes: The implementation adds two special read-only attributes:
\code{\var{f}.func_code} is a function's \dfn{code object} (see below) and \code{\var{f}.func_code} is a function's \dfn{code
\code{\var{f}.func_globals} is the dictionary used as the function's object}\obindex{code} (see below) and \code{\var{f}.func_globals} is
global name space (this is the same as \code{\var{m}.__dict__} where the dictionary used as the function's global name space (this is the
\var{m} is the module in which the function \var{f} was defined). same as \code{\var{m}.__dict__} where \var{m} is the module in which
the function \var{f} was defined).
\subsubsection{Methods} \subsubsection{Methods}
\obindex{method} \obindex{method}
...@@ -752,13 +756,13 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends. ...@@ -752,13 +756,13 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
non-negative, it is a maximum byte count (including the trailing non-negative, it is a maximum byte count (including the trailing
newline) and an incomplete line may be returned. newline) and an incomplete line may be returned.
An empty string is returned when \EOF{} is hit An empty string is returned when \EOF{} is hit
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned immediately. Note: unlike \code{stdio}'s \cfunction{fgets()}, the returned
string contains null characters (\code{'\e 0'}) if they occurred in the string contains null characters (\code{'\e 0'}) if they occurred in the
input. input.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{readlines}{\optional{sizehint}} \begin{methoddesc}[file]{readlines}{\optional{sizehint}}
Read until \EOF{} using \code{readline()} and return a list containing Read until \EOF{} using \method{readline()} and return a list containing
the lines thus read. If the optional \var{sizehint} argument is the lines thus read. If the optional \var{sizehint} argument is
present, instead of reading up to \EOF{}, whole lines totalling present, instead of reading up to \EOF{}, whole lines totalling
approximately \var{sizehint} bytes (possibly after rounding up to an approximately \var{sizehint} bytes (possibly after rounding up to an
...@@ -766,7 +770,7 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends. ...@@ -766,7 +770,7 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{seek}{offset, whence} \begin{methoddesc}[file]{seek}{offset, whence}
Set the file's current position, like \code{stdio}'s \code{fseek()}. Set the file's current position, like \code{stdio}'s \cfunction{fseek()}.
The \var{whence} argument is optional and defaults to \code{0} The \var{whence} argument is optional and defaults to \code{0}
(absolute file positioning); other values are \code{1} (seek (absolute file positioning); other values are \code{1} (seek
relative to the current position) and \code{2} (seek relative to the relative to the current position) and \code{2} (seek relative to the
...@@ -774,7 +778,8 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends. ...@@ -774,7 +778,8 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{tell}{} \begin{methoddesc}[file]{tell}{}
Return the file's current position, like \code{stdio}'s \code{ftell()}. Return the file's current position, like \code{stdio}'s
\cfunction{ftell()}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{truncate}{\optional{size}} \begin{methoddesc}[file]{truncate}{\optional{size}}
...@@ -788,13 +793,13 @@ operation). ...@@ -788,13 +793,13 @@ operation).
\begin{methoddesc}[file]{write}{str} \begin{methoddesc}[file]{write}{str}
Write a string to the file. There is no return value. Note: due to Write a string to the file. There is no return value. Note: due to
buffering, the string may not actually show up in the file until buffering, the string may not actually show up in the file until
the \code{flush()} or \code{close()} method is called. the \method{flush()} or \method{close()} method is called.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{writelines}{list} \begin{methoddesc}[file]{writelines}{list}
Write a list of strings to the file. There is no return value. Write a list of strings to the file. There is no return value.
(The name is intended to match \code{readlines}; \code{writelines} (The name is intended to match \method{readlines()};
does not add line separators.) \method{writelines()} does not add line separators.)
\end{methoddesc} \end{methoddesc}
File objects also offer the following attributes: File objects also offer the following attributes:
...@@ -823,9 +828,9 @@ attribute. ...@@ -823,9 +828,9 @@ attribute.
Boolean that indicates whether a space character needs to be printed Boolean that indicates whether a space character needs to be printed
before another value when using the \keyword{print} statement. before another value when using the \keyword{print} statement.
Classes that are trying to simulate a file object should also have a Classes that are trying to simulate a file object should also have a
writable \code{softspace} attribute, which should be initialized to writable \member{softspace} attribute, which should be initialized to
zero. This will be automatic for classes implemented in Python; types zero. This will be automatic for classes implemented in Python; types
implemented in \C{} will have to provide a writable \code{softspace} implemented in \C{} will have to provide a writable \member{softspace}
attribute. attribute.
\end{memberdesc} \end{memberdesc}
......
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