Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8efde21

Browse files
committed
Several minor markup nits.
1 parent 9f6aec8 commit 8efde21

2 files changed

Lines changed: 74 additions & 64 deletions

File tree

Doc/lib/libtypes.tex

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ \subsection{Comparisons}
145145
ordered by their type names; objects of the same types that don't
146146
support proper comparison are ordered by their address.)
147147

148-
Two more operations with the same syntactic priority, \code{in} and
149-
\code{not in}, are supported only by sequence types (below).
148+
Two more operations with the same syntactic priority, \samp{in} and
149+
\samp{not in}, are supported only by sequence types (below).
150150
\opindex{in}
151151
\opindex{not in}
152152

@@ -172,7 +172,7 @@ \subsection{Numeric Types}
172172

173173
Complex numbers have a real and imaginary part, which are both
174174
implemented using \code{double} in \C{}. To extract these parts from
175-
a complex number \code{z}, use \code{z.real} and \code{z.imag}.
175+
a complex number \var{z}, use \code{\var{z}.real} and \code{\var{z}.imag}.
176176

177177
Numbers are created by numeric literals or as the result of built-in
178178
functions and operators. Unadorned integer literals (including hex
@@ -230,7 +230,7 @@ \subsection{Numeric Types}
230230
\lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{}
231231
\lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)}
232232
\lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{}
233-
\lineiii{\var{x}**\var{y}}{\var{x} to the power \var{y}}{}
233+
\lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{}
234234
\end{tableiii}
235235
\indexiii{operations on}{numeric}{types}
236236

@@ -400,10 +400,12 @@ \subsubsection{More String Operations}
400400
argument, the right argument may also be a single non-tuple object.%
401401
\footnote{A tuple object in this case should be a singleton.}
402402
The following format characters are understood:
403-
\%, c, s, i, d, u, o, x, X, e, E, f, g, G.
404-
Width and precision may be a * to specify that an integer argument
405-
specifies the actual width or precision. The flag characters -, +,
406-
blank, \# and 0 are understood. The size specifiers h, l or L may be
403+
\code{\%}, \code{c}, \code{s}, \code{i}, \code{d}, \code{u}, \code{o},
404+
\code{x}, \code{X}, \code{e}, \code{E}, \code{f}, \code{g}, \code{G}.
405+
Width and precision may be a \code{*} to specify that an integer argument
406+
specifies the actual width or precision. The flag characters
407+
\code{-}, \code{+}, blank, \code{\#} and \code{0} are understood. The
408+
size specifiers \code{h}, \code{l} or \code{L} may be
407409
present but are ignored. The \code{\%s} conversion takes any Python
408410
object and converts it to a string using \code{str()} before
409411
formatting it. The ANSI features \code{\%p} and \code{\%n}
@@ -431,10 +433,9 @@ \subsubsection{More String Operations}
431433
>>> language = 'Python'
432434
>>> print '%(language)s has %(count)03d quote types.' % vars()
433435
Python has 002 quote types.
434-
>>>
435436
\end{verbatim}
436437

437-
In this case no * specifiers may occur in a format (since they
438+
In this case no \code{*} specifiers may occur in a format (since they
438439
require a sequential parameter list).
439440

440441
Additional string operations are defined in standard module
@@ -553,7 +554,7 @@ \subsection{Mapping Types}
553554
\lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)}
554555
\lineiii{\var{a}.update(\var{b})}{\code{for k, v in \var{b}.items(): \var{a}[k] = v}}{(3)}
555556
\lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)}
556-
\lineiii{\var{a}.get(\var{k}, \var{f})}{the item of \var{a} with key \var{k}}{(4)}
557+
\lineiii{\var{a}.get(\var{k}\optional{, \var{f}})}{the item of \var{a} with key \var{k}}{(4)}
557558
\end{tableiii}
558559
\indexiii{operations on}{mapping}{types}
559560
\indexiii{operations on}{dictionary}{type}
@@ -587,20 +588,21 @@ \subsection{Other Built-in Types}
587588
\subsubsection{Modules}
588589

589590
The only special operation on a module is attribute access:
590-
\code{\var{m}.\var{name}}, where \var{m} is a module and \var{name} accesses
591-
a name defined in \var{m}'s symbol table. Module attributes can be
592-
assigned to. (Note that the \code{import} statement is not, strictly
593-
spoken, an operation on a module object; \code{import \var{foo}} does not
594-
require a module object named \var{foo} to exist, rather it requires
595-
an (external) \emph{definition} for a module named \var{foo}
596-
somewhere.)
591+
\code{\var{m}.\var{name}}, where \var{m} is a module and \var{name}
592+
accesses a name defined in \var{m}'s symbol table. Module attributes
593+
can be assigned to. (Note that the \code{import} statement is not,
594+
strictly spoking, an operation on a module object; \code{import
595+
\var{foo}} does not require a module object named \var{foo} to exist,
596+
rather it requires an (external) \emph{definition} for a module named
597+
\var{foo} somewhere.)
597598

598599
A special member of every module is \code{__dict__}.
599600
This is the dictionary containing the module's symbol table.
600601
Modifying this dictionary will actually change the module's symbol
601602
table, but direct assignment to the \code{__dict__} attribute is not
602603
possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which
603-
defines \code{\var{m}.a} to be \code{1}, but you can't write \code{\var{m}.__dict__ = \{\}}.
604+
defines \code{\var{m}.a} to be \code{1}, but you can't write
605+
\code{\var{m}.__dict__ = \{\}}.
604606

605607
Modules are written like this: \code{<module 'sys'>}.
606608

@@ -621,10 +623,12 @@ \subsubsection{Functions}
621623
different object types.
622624

623625
The implementation adds two special read-only attributes:
624-
\code{\var{f}.func_code} is a function's \dfn{code object} (see below) and
625-
\code{\var{f}.func_globals} is the dictionary used as the function's
626-
global name space (this is the same as \code{\var{m}.__dict__} where
627-
\var{m} is the module in which the function \var{f} was defined).
626+
\code{\var{f}.func_code} is a function's \dfn{code
627+
object}\obindex{code} (see below) and \code{\var{f}.func_globals} is
628+
the dictionary used as the function's global name space (this is the
629+
same as \code{\var{m}.__dict__} where \var{m} is the module in which
630+
the function \var{f} was defined).
631+
628632

629633
\subsubsection{Methods}
630634
\obindex{method}
@@ -752,29 +756,30 @@ \subsubsection{File Objects}
752756
non-negative, it is a maximum byte count (including the trailing
753757
newline) and an incomplete line may be returned.
754758
An empty string is returned when \EOF{} is hit
755-
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned
759+
immediately. Note: unlike \code{stdio}'s \cfunction{fgets()}, the returned
756760
string contains null characters (\code{'\e 0'}) if they occurred in the
757761
input.
758762
\end{methoddesc}
759763

760764
\begin{methoddesc}[file]{readlines}{\optional{sizehint}}
761-
Read until \EOF{} using \code{readline()} and return a list containing
765+
Read until \EOF{} using \method{readline()} and return a list containing
762766
the lines thus read. If the optional \var{sizehint} argument is
763767
present, instead of reading up to \EOF{}, whole lines totalling
764768
approximately \var{sizehint} bytes (possibly after rounding up to an
765769
internal buffer size) are read.
766770
\end{methoddesc}
767771

768772
\begin{methoddesc}[file]{seek}{offset, whence}
769-
Set the file's current position, like \code{stdio}'s \code{fseek()}.
773+
Set the file's current position, like \code{stdio}'s \cfunction{fseek()}.
770774
The \var{whence} argument is optional and defaults to \code{0}
771775
(absolute file positioning); other values are \code{1} (seek
772776
relative to the current position) and \code{2} (seek relative to the
773777
file's end). There is no return value.
774778
\end{methoddesc}
775779

776780
\begin{methoddesc}[file]{tell}{}
777-
Return the file's current position, like \code{stdio}'s \code{ftell()}.
781+
Return the file's current position, like \code{stdio}'s
782+
\cfunction{ftell()}.
778783
\end{methoddesc}
779784

780785
\begin{methoddesc}[file]{truncate}{\optional{size}}
@@ -788,13 +793,13 @@ \subsubsection{File Objects}
788793
\begin{methoddesc}[file]{write}{str}
789794
Write a string to the file. There is no return value. Note: due to
790795
buffering, the string may not actually show up in the file until
791-
the \code{flush()} or \code{close()} method is called.
796+
the \method{flush()} or \method{close()} method is called.
792797
\end{methoddesc}
793798

794799
\begin{methoddesc}[file]{writelines}{list}
795800
Write a list of strings to the file. There is no return value.
796-
(The name is intended to match \code{readlines}; \code{writelines}
797-
does not add line separators.)
801+
(The name is intended to match \method{readlines()};
802+
\method{writelines()} does not add line separators.)
798803
\end{methoddesc}
799804

800805
File objects also offer the following attributes:
@@ -823,9 +828,9 @@ \subsubsection{File Objects}
823828
Boolean that indicates whether a space character needs to be printed
824829
before another value when using the \keyword{print} statement.
825830
Classes that are trying to simulate a file object should also have a
826-
writable \code{softspace} attribute, which should be initialized to
831+
writable \member{softspace} attribute, which should be initialized to
827832
zero. This will be automatic for classes implemented in Python; types
828-
implemented in \C{} will have to provide a writable \code{softspace}
833+
implemented in \C{} will have to provide a writable \member{softspace}
829834
attribute.
830835
\end{memberdesc}
831836

Doc/libtypes.tex

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ \subsection{Comparisons}
145145
ordered by their type names; objects of the same types that don't
146146
support proper comparison are ordered by their address.)
147147

148-
Two more operations with the same syntactic priority, \code{in} and
149-
\code{not in}, are supported only by sequence types (below).
148+
Two more operations with the same syntactic priority, \samp{in} and
149+
\samp{not in}, are supported only by sequence types (below).
150150
\opindex{in}
151151
\opindex{not in}
152152

@@ -172,7 +172,7 @@ \subsection{Numeric Types}
172172

173173
Complex numbers have a real and imaginary part, which are both
174174
implemented using \code{double} in \C{}. To extract these parts from
175-
a complex number \code{z}, use \code{z.real} and \code{z.imag}.
175+
a complex number \var{z}, use \code{\var{z}.real} and \code{\var{z}.imag}.
176176

177177
Numbers are created by numeric literals or as the result of built-in
178178
functions and operators. Unadorned integer literals (including hex
@@ -230,7 +230,7 @@ \subsection{Numeric Types}
230230
\lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{}
231231
\lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)}
232232
\lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{}
233-
\lineiii{\var{x}**\var{y}}{\var{x} to the power \var{y}}{}
233+
\lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{}
234234
\end{tableiii}
235235
\indexiii{operations on}{numeric}{types}
236236

@@ -400,10 +400,12 @@ \subsubsection{More String Operations}
400400
argument, the right argument may also be a single non-tuple object.%
401401
\footnote{A tuple object in this case should be a singleton.}
402402
The following format characters are understood:
403-
\%, c, s, i, d, u, o, x, X, e, E, f, g, G.
404-
Width and precision may be a * to specify that an integer argument
405-
specifies the actual width or precision. The flag characters -, +,
406-
blank, \# and 0 are understood. The size specifiers h, l or L may be
403+
\code{\%}, \code{c}, \code{s}, \code{i}, \code{d}, \code{u}, \code{o},
404+
\code{x}, \code{X}, \code{e}, \code{E}, \code{f}, \code{g}, \code{G}.
405+
Width and precision may be a \code{*} to specify that an integer argument
406+
specifies the actual width or precision. The flag characters
407+
\code{-}, \code{+}, blank, \code{\#} and \code{0} are understood. The
408+
size specifiers \code{h}, \code{l} or \code{L} may be
407409
present but are ignored. The \code{\%s} conversion takes any Python
408410
object and converts it to a string using \code{str()} before
409411
formatting it. The ANSI features \code{\%p} and \code{\%n}
@@ -431,10 +433,9 @@ \subsubsection{More String Operations}
431433
>>> language = 'Python'
432434
>>> print '%(language)s has %(count)03d quote types.' % vars()
433435
Python has 002 quote types.
434-
>>>
435436
\end{verbatim}
436437

437-
In this case no * specifiers may occur in a format (since they
438+
In this case no \code{*} specifiers may occur in a format (since they
438439
require a sequential parameter list).
439440

440441
Additional string operations are defined in standard module
@@ -553,7 +554,7 @@ \subsection{Mapping Types}
553554
\lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)}
554555
\lineiii{\var{a}.update(\var{b})}{\code{for k, v in \var{b}.items(): \var{a}[k] = v}}{(3)}
555556
\lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)}
556-
\lineiii{\var{a}.get(\var{k}, \var{f})}{the item of \var{a} with key \var{k}}{(4)}
557+
\lineiii{\var{a}.get(\var{k}\optional{, \var{f}})}{the item of \var{a} with key \var{k}}{(4)}
557558
\end{tableiii}
558559
\indexiii{operations on}{mapping}{types}
559560
\indexiii{operations on}{dictionary}{type}
@@ -587,20 +588,21 @@ \subsection{Other Built-in Types}
587588
\subsubsection{Modules}
588589

589590
The only special operation on a module is attribute access:
590-
\code{\var{m}.\var{name}}, where \var{m} is a module and \var{name} accesses
591-
a name defined in \var{m}'s symbol table. Module attributes can be
592-
assigned to. (Note that the \code{import} statement is not, strictly
593-
spoken, an operation on a module object; \code{import \var{foo}} does not
594-
require a module object named \var{foo} to exist, rather it requires
595-
an (external) \emph{definition} for a module named \var{foo}
596-
somewhere.)
591+
\code{\var{m}.\var{name}}, where \var{m} is a module and \var{name}
592+
accesses a name defined in \var{m}'s symbol table. Module attributes
593+
can be assigned to. (Note that the \code{import} statement is not,
594+
strictly spoking, an operation on a module object; \code{import
595+
\var{foo}} does not require a module object named \var{foo} to exist,
596+
rather it requires an (external) \emph{definition} for a module named
597+
\var{foo} somewhere.)
597598

598599
A special member of every module is \code{__dict__}.
599600
This is the dictionary containing the module's symbol table.
600601
Modifying this dictionary will actually change the module's symbol
601602
table, but direct assignment to the \code{__dict__} attribute is not
602603
possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which
603-
defines \code{\var{m}.a} to be \code{1}, but you can't write \code{\var{m}.__dict__ = \{\}}.
604+
defines \code{\var{m}.a} to be \code{1}, but you can't write
605+
\code{\var{m}.__dict__ = \{\}}.
604606

605607
Modules are written like this: \code{<module 'sys'>}.
606608

@@ -621,10 +623,12 @@ \subsubsection{Functions}
621623
different object types.
622624

623625
The implementation adds two special read-only attributes:
624-
\code{\var{f}.func_code} is a function's \dfn{code object} (see below) and
625-
\code{\var{f}.func_globals} is the dictionary used as the function's
626-
global name space (this is the same as \code{\var{m}.__dict__} where
627-
\var{m} is the module in which the function \var{f} was defined).
626+
\code{\var{f}.func_code} is a function's \dfn{code
627+
object}\obindex{code} (see below) and \code{\var{f}.func_globals} is
628+
the dictionary used as the function's global name space (this is the
629+
same as \code{\var{m}.__dict__} where \var{m} is the module in which
630+
the function \var{f} was defined).
631+
628632

629633
\subsubsection{Methods}
630634
\obindex{method}
@@ -752,29 +756,30 @@ \subsubsection{File Objects}
752756
non-negative, it is a maximum byte count (including the trailing
753757
newline) and an incomplete line may be returned.
754758
An empty string is returned when \EOF{} is hit
755-
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned
759+
immediately. Note: unlike \code{stdio}'s \cfunction{fgets()}, the returned
756760
string contains null characters (\code{'\e 0'}) if they occurred in the
757761
input.
758762
\end{methoddesc}
759763

760764
\begin{methoddesc}[file]{readlines}{\optional{sizehint}}
761-
Read until \EOF{} using \code{readline()} and return a list containing
765+
Read until \EOF{} using \method{readline()} and return a list containing
762766
the lines thus read. If the optional \var{sizehint} argument is
763767
present, instead of reading up to \EOF{}, whole lines totalling
764768
approximately \var{sizehint} bytes (possibly after rounding up to an
765769
internal buffer size) are read.
766770
\end{methoddesc}
767771

768772
\begin{methoddesc}[file]{seek}{offset, whence}
769-
Set the file's current position, like \code{stdio}'s \code{fseek()}.
773+
Set the file's current position, like \code{stdio}'s \cfunction{fseek()}.
770774
The \var{whence} argument is optional and defaults to \code{0}
771775
(absolute file positioning); other values are \code{1} (seek
772776
relative to the current position) and \code{2} (seek relative to the
773777
file's end). There is no return value.
774778
\end{methoddesc}
775779

776780
\begin{methoddesc}[file]{tell}{}
777-
Return the file's current position, like \code{stdio}'s \code{ftell()}.
781+
Return the file's current position, like \code{stdio}'s
782+
\cfunction{ftell()}.
778783
\end{methoddesc}
779784

780785
\begin{methoddesc}[file]{truncate}{\optional{size}}
@@ -788,13 +793,13 @@ \subsubsection{File Objects}
788793
\begin{methoddesc}[file]{write}{str}
789794
Write a string to the file. There is no return value. Note: due to
790795
buffering, the string may not actually show up in the file until
791-
the \code{flush()} or \code{close()} method is called.
796+
the \method{flush()} or \method{close()} method is called.
792797
\end{methoddesc}
793798

794799
\begin{methoddesc}[file]{writelines}{list}
795800
Write a list of strings to the file. There is no return value.
796-
(The name is intended to match \code{readlines}; \code{writelines}
797-
does not add line separators.)
801+
(The name is intended to match \method{readlines()};
802+
\method{writelines()} does not add line separators.)
798803
\end{methoddesc}
799804

800805
File objects also offer the following attributes:
@@ -823,9 +828,9 @@ \subsubsection{File Objects}
823828
Boolean that indicates whether a space character needs to be printed
824829
before another value when using the \keyword{print} statement.
825830
Classes that are trying to simulate a file object should also have a
826-
writable \code{softspace} attribute, which should be initialized to
831+
writable \member{softspace} attribute, which should be initialized to
827832
zero. This will be automatic for classes implemented in Python; types
828-
implemented in \C{} will have to provide a writable \code{softspace}
833+
implemented in \C{} will have to provide a writable \member{softspace}
829834
attribute.
830835
\end{memberdesc}
831836

0 commit comments

Comments
 (0)