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

Skip to content

Commit 5a25aa6

Browse files
committed
Fix spelling and add markup.
1 parent 7cf4d9b commit 5a25aa6

1 file changed

Lines changed: 62 additions & 59 deletions

File tree

Doc/tut/glossary.tex

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
\chapter{Glossary\label{glossary}}
22

33
%%% keep the entries sorted and include at least one \index{} item for each
4+
%%% cross-references are marked with \emph{entry}
45

56
\begin{description}
67

@@ -13,7 +14,7 @@ \chapter{Glossary\label{glossary}}
1314
for code examples that can be tried right away in the interpreter.}
1415

1516
\index{__slots__}
16-
\item[__slots__]{A declaration inside a new-style class that saves
17+
\item[__slots__]{A declaration inside a \emph{new-style class} that saves
1718
memory by pre-declaring space for instance attributes and eliminating
1819
instance dictionaries. Though popular, the technique is somewhat tricky to
1920
get right and is best reserved for rare cases where there are large numbers
@@ -24,7 +25,7 @@ \chapter{Glossary\label{glossary}}
2425
Rossum}{http://www.python.org/~guido/}, Python's creator.}
2526

2627
\index{byte code}
27-
\item[byte code]{The internal represenatation of a Python program in the
28+
\item[byte code]{The internal representation of a Python program in the
2829
interpreter. The byte code is also cached in the \code{.pyc} and
2930
{}\code{.pyo} files so that executing the same file is faster the second
3031
time (compilation from source to byte code can be saved). This
@@ -37,51 +38,52 @@ \chapter{Glossary\label{glossary}}
3738

3839
\index{coercion}
3940
\item[coercion]{Converting data from one type to another. For example,
40-
int(3.15) coerces the floating point number to the integer, 3. Most
41-
mathematical operations have rules for coercing their arguments to a common
42-
type. For instance, adding 3 + 4.5, causes the integer 3 to be coerced to
43-
be a float (3.0) before adding to 4.5 resulting in the float 7.5.}
41+
{}\code{int(3.15)} coerces the floating point number to the integer, \code{3}.
42+
Most mathematical operations have rules for coercing their arguments to a common
43+
type. For instance, adding \code{3 + 4.5}, causes the integer \code{3} to be
44+
coerced to be a float \code{3.0} before adding to \code{4.5} resulting in the
45+
float \code{7.5}.}
4446

4547
\index{descriptor}
46-
\item[descriptor]{Any object that defines the methods __get__(), __set__(),
47-
or __delete__(). When a class attribute is a descriptor, its special
48-
binding behavior is triggered upon attribute lookup. Normally, writing
49-
{}\var{a.b} looks up the object \var{b} in the class dictionary for \var{a},
50-
but if \var{b} is a descriptor, the defined method gets called.
51-
Understanding descriptors is a key to a deep understanding of Python because
52-
they are the basis for many features including functions,
53-
methods,properties, class methods, static methods, and reference to super
48+
\item[descriptor]{Any object that defines the methods \method{__get__()},
49+
\method{__set__()}, or \method{__delete__()}. When a class attribute is a
50+
descriptor, its special binding behavior is triggered upon attribute lookup.
51+
Normally, writing {}\var{a.b} looks up the object \var{b} in the class
52+
dictionary for \var{a}, but if \var{b} is a descriptor, the defined method
53+
gets called. Understanding descriptors is a key to a deep understanding of
54+
Python because they are the basis for many features including functions,
55+
methods, properties, class methods, static methods, and reference to super
5456
classes.}
5557

5658
\index{dictionary}
5759
\item[dictionary]{An associative array, where arbitrary keys are mapped to
58-
values. The use of `dict` much resembles that for `list`, but the keys can
59-
be any object with a `__hash__` function, not just integers starting from
60-
zero. Called a hash in Perl.}
60+
values. The use of \class{dict} much resembles that for \class{list}, but
61+
the keys can be any object with a \function{__hash__} function, not just
62+
integers starting from zero. Called a hash in Perl.}
6163

6264
\index{EAFP}
6365
\item[EAFP]{Easier to ask for forgiveness than permission. This common
64-
Python coding style assumes the existance of valid keys or attributes and
66+
Python coding style assumes the existence of valid keys or attributes and
6567
catches exceptions if the assumption proves false. This clean and fast
66-
style is characterized by the presence of many `try` and `except` statments.
67-
The technique contrasts with the '''LBYL''' style that is common in many
68-
other languages such as C.}
68+
style is characterized by the presence of many \keyword{try} and
69+
{}\keyword{except} statements. The technique contrasts with the \emph{LBYL}
70+
style that is common in many other languages such as C.}
6971

7072
\index{__future__}
7173
\item[__future__]{A pseudo module which programmers can use to enable
7274
new language features which are not compatible with the current interpreter.
7375
For example, the expression \code{11 / 4} currently evaluates to \code{2}.
74-
If the module in which it is executed had enabled ``true division`` by
75-
executing}
76+
If the module in which it is executed had enabled emph{true division} by
77+
executing:}
7678

7779
\begin{verbatim}
7880
from __future__ import division
7981
\end{verbatim}
8082

8183
the expression \code{11 / 4} would evaluate to \code{2.75}. By actually
82-
importing the __future__ module and evaluating its variables, you can see
83-
when a new feature was first added to the language and when it will becode
84-
the default:
84+
importing the \module{__future__} module and evaluating its variables, you
85+
can see when a new feature was first added to the language and when it will
86+
become the default:
8587

8688
\begin{verbatim}
8789
>>> import __future__
@@ -99,7 +101,7 @@ \chapter{Glossary\label{glossary}}
99101
requested by calling the \function{next()} method of the returned iterator.}
100102

101103
\index{GIL}
102-
\item[GIL]{See \em{global interpreter lock}.}
104+
\item[GIL]{See \emph{global interpreter lock}.}
103105

104106
\index{global interpreter lock}
105107
\item[global interpreter lock]{the lock used by Python threads to assure
@@ -113,9 +115,9 @@ \chapter{Glossary\label{glossary}}
113115

114116
\index{IDLE}
115117
\item[IDLE]{an Integrated Development Environment for Python. IDLE is a
116-
basic editor and intepreter environment that ships with the standard
117-
distribution of Python. Good for beginners and those on a budget, it also
118-
serves as clear example code for those wanting to implement a moderately
118+
basic editor and interpreter environment that ships with the standard
119+
distribution of Python. Good for beginners, it also serves as clear
120+
example code for those wanting to implement a moderately
119121
sophisticated, multi-platform GUI application.}
120122

121123
\index{immutable}
@@ -127,15 +129,16 @@ \chapter{Glossary\label{glossary}}
127129

128130
\index{integer division}
129131
\item[integer division]{Mathematical division discarding any remainder. For
130-
example, the expression \code{11 / 4} currently evaluates to 2 in contrast
131-
to the 2.75 returned by float division. Also called "floor division". When
132-
dividing two integers the outcome will always be another integer (having the
133-
floor function applied to it). However, if one of the operands is another
134-
numeric type (such as a float), the result will be coerced (see coercion) to
135-
a common type. For example, a integer divided by a float will result in a
136-
float value, possibly with a decimal fraction. Integer division can be
137-
forced by using the \code{//} operator instead of the \code{/} operator.
138-
See also, __future__.}
132+
example, the expression \code{11 / 4} currently evaluates to \code{2} in
133+
contrast to the \code{2.75} returned by float division. Also called
134+
\emph{floor division}. When dividing two integers the outcome will always be
135+
another integer (having the floor function applied to it). However, if one
136+
of the operands is another numeric type (such as a \class{float}), the result
137+
will be coerced (see \emph{coercion}) to a common type. For example, a integer
138+
divided by a float will result in a float value, possibly with a decimal
139+
fraction. Integer division can be forced by using the \code{//} operator
140+
instead of the \code{/} operator.
141+
See also, \emph{__future__}.}
139142

140143
\index{interactive}
141144
\item[interactive]{Python has an interactive interpreter which means that
@@ -147,16 +150,16 @@ \chapter{Glossary\label{glossary}}
147150
\index{interpreted}
148151
\item[interpreted]{Python is an interpreted language, opposed to a compiled
149152
one. This means that the source files can be run right away without first
150-
making an executable which is then run. Interpreted languages typicaly have
153+
making an executable which is then run. Interpreted languages typically have
151154
a shorter development/debug cycle than compiled ones. See also
152-
{}\em{interactive}.}
155+
{}\emph{interactive}.}
153156

154157
\index{iterable}
155158
\item[iterable]{A container object capable of returning its members one at a
156-
time. Examples of iterables include all sequence types (\class{list},
157-
{}\class{str}, \class{tuple}, etc.) and some non-sequence types like
159+
time. Examples of iterables include all sequence types (such as\class{list},
160+
{}\class{str}, and \class{tuple}) and some non-sequence types like
158161
{}\class{dict} and \class{file} and objects of any classes you define with
159-
an \function{__iter__} or \function{__getitem__} method. Iterables can be
162+
an \method{__iter__} or \function{__getitem__} method. Iterables can be
160163
used in a \keyword{for} loop and in many other places where a sequence is
161164
needed (\function{zip}, \function{map}, ...). When an iterable object is
162165
passed as an argument to the builtin function \function{iter()}, it returns
@@ -165,23 +168,23 @@ \chapter{Glossary\label{glossary}}
165168
{}\function{iter()} or deal with iterator objects yourself - the \code{for}
166169
statement does that automatically for you, creating a temporary unnamed
167170
variable to hold the iterator for the duration of the loop. See also
168-
iterator, sequence and generator.}
171+
\emph{iterator}, \emph{sequence} and \emph{generator}.}
169172

170173
\index{iterator}
171174
\item[iterator]{An object representing a stream of data. Repeated calls to
172175
the iterator's \function{next()} method return successive items in the
173176
stream. When no more data is available a \exception{StopIteration}
174-
exception is raised instead. At this point the iterator object is exhausted
177+
exception is raised instead. At this point, the iterator object is exhausted
175178
and any further calls to its \function{next()} method just raise
176179
{}\exception{StopIteration} again. Iterators are required to have an
177180
{}\function{__iter__()} method that returns the iterator object itself so
178181
every iterator is also iterable and may be used in most places where other
179182
iterables are accepted. One notable exception is code that attempts
180-
multiple iteration passes. A container object (such as a list) produces a
181-
fresh new iterator each time you pass it to the \function{iter()} function
182-
or use it in a \function{for} loop. Attempting this with an iterator will
183-
just return the same exhausted iterator object from the second iteration
184-
pass and on, making it appear like an empty container.}
183+
multiple iteration passes. A container object (such as a \class{list})
184+
produces a fresh new iterator each time you pass it to the \function{iter()}
185+
function or use it in a \function{for} loop. Attempting this with an iterator
186+
will just return the same exhausted iterator object from the second iteration
187+
pass, making it appear like an empty container.}
185188

186189
\index{list comprehension}
187190
\item[list comprehension]{A compact way to process all or a subset of elements
@@ -209,8 +212,8 @@ \chapter{Glossary\label{glossary}}
209212
\index{LBYL}
210213
\item[LBYL]{Look before you leap. This coding style explicitly tests for
211214
pre-conditions before making calls or lookups. This style contrasts with
212-
the EAFP approach and is characterized the presence of many \keyword{if}
213-
statements.}
215+
the \emph{EAFP} approach and is characterized the presence of many
216+
{}\keyword{if} statements.}
214217

215218
\index{mutable}
216219
\item[mutable]{Mutable objects can change their value but keep their
@@ -223,7 +226,7 @@ \chapter{Glossary\label{glossary}}
223226
support modularity by preventing naming conflicts. For instance, the
224227
functions \function{__builtins__.open()} and \function{os.open()} are
225228
distinguished by their namespaces. Namespaces also aid readability and
226-
maintainabilty by making it clear which modules implement a function. For
229+
maintainability by making it clear which modules implement a function. For
227230
instance, writing \function{random.seed()} or \function{itertools.izip()}
228231
makes it clear that those functions are implemented by the \module{random}
229232
and \module{itertools} modules respectively.}
@@ -239,8 +242,8 @@ \chapter{Glossary\label{glossary}}
239242

240243
\index{new-style class}
241244
\item[new-style class]{Any class that inherits from \class{object}. This
242-
includes all built-in types like \class{list} and \class{dict}. Only new
243-
style classes can use Python's newer, versatile features like
245+
includes all built-in types like \class{list} and \class{dict}. Only
246+
new-style classes can use Python's newer, versatile features like
244247
{}\var{__slots__}, descriptors, properties, \var{__getattribute__}, class
245248
methods, and static methods.}
246249

@@ -249,17 +252,17 @@ \chapter{Glossary\label{glossary}}
249252
compatible, with telepathic interface.}
250253

251254
\index{sequence}
252-
\item[sequence]{An iterable which supports efficient element access using
255+
\item[sequence]{An \emph{iterable} which supports efficient element access using
253256
integer indices via the \function{__getitem__} and \function{__len()__}
254257
special methods. Some builtin sequence types are \class{list}, \class{str},
255258
{}\class{tuple}, and \class{unicode}. Note that \class{dict} also supports
256259
{}\function{__getitem__} and \function{__len__}, but is considered a mapping
257-
rather than a sequence because the lookups use arbitrary immutable keys
260+
rather than a sequence because the lookups use arbitrary \emph{immutable} keys
258261
rather than integers.}
259262

260263
\index{Zen of Python}
261264
\item[Zen of Python]{listing of Python design principles and philosophies
262265
that are helpful in understanding and using the language. The listing can
263-
be found by typing "import this" at the interactive prompt.}
266+
be found by typing \code{import this} at the interactive prompt.}
264267

265268
\end{description}

0 commit comments

Comments
 (0)