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

Skip to content

Commit a1cce71

Browse files
committed
Converted some {tabular}s to use {tablei*} environments.
1 parent 30e5265 commit a1cce71

2 files changed

Lines changed: 64 additions & 69 deletions

File tree

Doc/ref/ref2.tex

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\chapter{Lexical analysis}
1+
\chapter{Lexical analysis\label{lexical}}
22

33
A Python program is read by a \emph{parser}. Input to the parser is a
44
stream of \emph{tokens}, generated by the \emph{lexical analyzer}. This
@@ -33,7 +33,7 @@ \section{Line structure}
3333
A Python program is divided into a number of \emph{logical lines}.
3434
\index{line structure}
3535

36-
\subsection{Logical Lines}
36+
\subsection{Logical lines}
3737

3838
The end of
3939
a logical line is represented by the token NEWLINE. Statements cannot
@@ -259,17 +259,11 @@ \subsection{Reserved classes of identifiers}
259259
Certain classes of identifiers (besides keywords) have special
260260
meanings. These are:
261261

262-
\begin{center}
263-
\begin{tabular}{|l|l|}
264-
\hline
265-
Form & Meaning \\
266-
\hline
267-
\code{_*} & Not imported by \code{from \var{module} import *} \\
268-
\code{__*__} & System-defined name \\
269-
\code{__*} & Class-private name mangling \\
270-
\hline
271-
\end{tabular}
272-
\end{center}
262+
\begin{tableii}{l|l}{code}{Form}{Meaning}
263+
\lineii{_*}{Not imported by \samp{from \var{module} import *}}
264+
\lineii{__*__}{System-defined name}
265+
\lineii{__*}{Class-private name mangling}
266+
\end{tableii}
273267

274268
(XXX need section references here.)
275269

@@ -322,27 +316,21 @@ \subsection{String literals}
322316
\index{Standard C}
323317
\index{C}
324318

325-
\begin{center}
326-
\begin{tabular}{|l|l|}
327-
\hline
328-
Escape Sequence & Meaning \\
329-
\hline
330-
\code{\e}\emph{newline} & Ignored \\
331-
\code{\e\e} & Backslash (\code{\e}) \\
332-
\code{\e'} & Single quote (\code{'}) \\
333-
\code{\e"} & Double quote (\code{"}) \\
334-
\code{\e a} & \ASCII{} Bell (BEL) \\
335-
\code{\e b} & \ASCII{} Backspace (BS) \\
336-
\code{\e f} & \ASCII{} Formfeed (FF) \\
337-
\code{\e n} & \ASCII{} Linefeed (LF) \\
338-
\code{\e r} & \ASCII{} Carriage Return (CR) \\
339-
\code{\e t} & \ASCII{} Horizontal Tab (TAB) \\
340-
\code{\e v} & \ASCII{} Vertical Tab (VT) \\
341-
\code{\e}\emph{ooo} & \ASCII{} character with octal value \emph{ooo} \\
342-
\code{\e x}\emph{hh...} & \ASCII{} character with hex value \emph{hh...} \\
343-
\hline
344-
\end{tabular}
345-
\end{center}
319+
\begin{tableii}{l|l}{code}{Escape Sequence}{Meaning}
320+
\lineii{\e\var{newline}} {Ignored}
321+
\lineii{\e\e} {Backslash (\code{\e})}
322+
\lineii{\e'} {Single quote (\code{'})}
323+
\lineii{\e"} {Double quote (\code{"})}
324+
\lineii{\e a} {\ASCII{} Bell (BEL)}
325+
\lineii{\e b} {\ASCII{} Backspace (BS)}
326+
\lineii{\e f} {\ASCII{} Formfeed (FF)}
327+
\lineii{\e n} {\ASCII{} Linefeed (LF)}
328+
\lineii{\e r} {\ASCII{} Carriage Return (CR)}
329+
\lineii{\e t} {\ASCII{} Horizontal Tab (TAB)}
330+
\lineii{\e v} {\ASCII{} Vertical Tab (VT)}
331+
\lineii{\e\var{ooo}} {\ASCII{} character with octal value \emph{ooo}}
332+
\lineii{\e x\var{hh...}} {\ASCII{} character with hex value \emph{hh...}}
333+
\end{tableii}
346334
\index{ASCII@\ASCII{}}
347335

348336
In strict compatibility with Standard \C, up to three octal digits are

Doc/ref/ref4.tex

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
\chapter{Execution model}
1+
\chapter{Execution model\label{execmodel}}
22
\index{execution model}
33

44
\section{Code blocks, execution frames, and namespaces} \label{execframes}
55
\index{code block}
66
\indexii{execution}{frame}
77
\index{namespace}
88

9-
A {\em code block} is a piece of Python program text that can be
9+
A \dfn{code block} is a piece of Python program text that can be
1010
executed as a unit, such as a module, a class definition or a function
1111
body. Some code blocks (like modules) are normally executed only once, others
1212
(like function bodies) may be executed many times. Code blocks may
@@ -29,28 +29,28 @@ \section{Code blocks, execution frames, and namespaces} \label{execframes}
2929
read and evaluated by the built-in function \function{input()} is a
3030
code block.
3131

32-
A code block is executed in an execution frame. An {\em execution
32+
A code block is executed in an execution frame. An \dfn{execution
3333
frame} contains some administrative information (used for debugging),
3434
determines where and how execution continues after the code block's
3535
execution has completed, and (perhaps most importantly) defines two
3636
namespaces, the local and the global namespace, that affect
3737
execution of the code block.
3838
\indexii{execution}{frame}
3939

40-
A {\em namespace} is a mapping from names (identifiers) to objects.
40+
A \dfn{namespace} is a mapping from names (identifiers) to objects.
4141
A particular namespace may be referenced by more than one execution
4242
frame, and from other places as well. Adding a name to a namespace
43-
is called {\em binding} a name (to an object); changing the mapping of
44-
a name is called {\em rebinding}; removing a name is {\em unbinding}.
43+
is called \dfn{binding} a name (to an object); changing the mapping of
44+
a name is called \dfn{rebinding}; removing a name is \dfn{unbinding}.
4545
Namespaces are functionally equivalent to dictionaries (and often
4646
implemented as dictionaries).
4747
\index{namespace}
4848
\indexii{binding}{name}
4949
\indexii{rebinding}{name}
5050
\indexii{unbinding}{name}
5151

52-
The {\em local namespace} of an execution frame determines the default
53-
place where names are defined and searched. The {\em global
52+
The \dfn{local namespace} of an execution frame determines the default
53+
place where names are defined and searched. The \dfn{global
5454
namespace} determines the place where names listed in \keyword{global}
5555
statements are defined and searched, and where names that are not
5656
bound anywhere in the current code block are searched.
@@ -105,36 +105,43 @@ \section{Code blocks, execution frames, and namespaces} \label{execframes}
105105
the global namespace is the namespace of the containing module ---
106106
scopes in Python do not nest!
107107

108-
\begin{center}
109-
\begin{tabular}{|l|l|l|l|}
110-
\hline
111-
Code block type & Global namespace & Local namespace & Notes \\
112-
\hline
113-
Module & n.s. for this module & same as global & \\
114-
Script (file or command) & n.s. for \module{__main__} & same as global
115-
& (1) \\
116-
Interactive command & n.s. for \module{__main__} & same as global & \\
117-
Class definition & global n.s. of containing block & new n.s. & \\
118-
Function body & global n.s. of containing block & new n.s. & (2) \\
119-
String passed to \keyword{exec} statement
120-
& global n.s. of containing block
121-
& local n.s. of containing block & (2), (3) \\
122-
String passed to \function{eval()}
123-
& global n.s. of caller & local n.s. of caller & (2), (3) \\
124-
File read by \function{execfile()}
125-
& global n.s. of caller & local n.s. of caller & (2), (3) \\
126-
Expression read by \function{input()}
127-
& global n.s. of caller & local n.s. of caller & \\
128-
\hline
129-
\end{tabular}
130-
\end{center}
108+
\begin{tableiv}{l|l|l|l}{textrm}%
109+
{Code block type}{Global namespace}{Local namespace}{Notes}
110+
\lineiv{Module}%
111+
{n.s. for this module}%
112+
{same as global}{}
113+
\lineiv{Script (file or command)}%
114+
{n.s. for \module{__main__}}%
115+
{same as global}{(1)}
116+
\lineiv{Interactive command}%
117+
{n.s. for \module{__main__}}%
118+
{same as global}{}
119+
\lineiv{Class definition}%
120+
{global n.s. of containing block}%
121+
{new n.s.}{}
122+
\lineiv{Function body}%
123+
{global n.s. of containing block}%
124+
{new n.s.}{(2)}
125+
\lineiv{String passed to \keyword{exec} statement}%
126+
{global n.s. of containing block}%
127+
{local n.s. of containing block}{(2), (3)}
128+
\lineiv{String passed to \function{eval()}}%
129+
{global n.s. of caller}%
130+
{local n.s. of caller}{(2), (3)}
131+
\lineiv{File read by \function{execfile()}}%
132+
{global n.s. of caller}%
133+
{local n.s. of caller}{(2), (3)}
134+
\lineiv{Expression read by \function{input()}}%
135+
{global n.s. of caller}%
136+
{local n.s. of caller}{}
137+
\end{tableiv}
131138
\refbimodindex{__main__}
132139

133140
Notes:
134141

135142
\begin{description}
136143

137-
\item[n.s.] means {\em namespace}
144+
\item[n.s.] means \emph{namespace}
138145

139146
\item[(1)] The main module for a script is always called
140147
\module{__main__}; ``the filename don't enter into it.''
@@ -154,16 +161,16 @@ \section{Code blocks, execution frames, and namespaces} \label{execframes}
154161
respectively. The effect of modifications to this dictionary on the
155162
namespace are undefined.%
156163
\footnote{The current implementations return the dictionary actually
157-
used to implement the namespace, {\em except} for functions, where
164+
used to implement the namespace, \emph{except} for functions, where
158165
the optimizer may cause the local namespace to be implemented
159166
differently, and \function{locals()} returns a read-only dictionary.}
160167

161168
\section{Exceptions}
162169

163170
Exceptions are a means of breaking out of the normal flow of control
164171
of a code block in order to handle errors or other exceptional
165-
conditions. An exception is {\em raised} at the point where the error
166-
is detected; it may be {\em handled} by the surrounding code block or
172+
conditions. An exception is \emph{raised} at the point where the error
173+
is detected; it may be \emph{handled} by the surrounding code block or
167174
by any code block that directly or indirectly invoked the code block
168175
where the error occurred.
169176
\index{exception}

0 commit comments

Comments
 (0)