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

Skip to content

Commit 15e33d8

Browse files
committed
Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
translation more difficult, as well as reading the English more difficult for non-native speakers.
1 parent 1a7f16c commit 15e33d8

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

Doc/ext/ext.tex

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ \section{A Simple Example
129129
\end{verbatim}
130130

131131
There is a straightforward translation from the argument list in
132-
Python (e.g.\ the single expression \code{"ls -l"}) to the arguments
133-
passed to the C function. The C function always has two arguments,
134-
conventionally named \var{self} and \var{args}.
132+
Python (for example, the single expression \code{"ls -l"}) to the
133+
arguments passed to the C function. The C function always has two
134+
arguments, conventionally named \var{self} and \var{args}.
135135

136136
The \var{self} argument is only used when the C function implements a
137137
built-in method, not a function. In the example, \var{self} will
@@ -200,7 +200,7 @@ \section{Intermezzo: Errors and Exceptions
200200

201201
When a function \var{f} that calls another function \var{g} detects
202202
that the latter fails, \var{f} should itself return an error value
203-
(e.g.\ \NULL{} or \code{-1}). It should \emph{not} call one of the
203+
(usually \NULL{} or \code{-1}). It should \emph{not} call one of the
204204
\cfunction{PyErr_*()} functions --- one has already been called by \var{g}.
205205
\var{f}'s caller is then supposed to also return an error indication
206206
to \emph{its} caller, again \emph{without} calling \cfunction{PyErr_*()},
@@ -220,8 +220,8 @@ \section{Intermezzo: Errors and Exceptions
220220
condition must be cleared explicitly by calling \cfunction{PyErr_Clear()}.
221221
The only time C code should call \cfunction{PyErr_Clear()} is if it doesn't
222222
want to pass the error on to the interpreter but wants to handle it
223-
completely by itself (e.g.\ by trying something else or pretending
224-
nothing happened).
223+
completely by itself (possibly by trying something else, or pretending
224+
nothing went wrong).
225225

226226
Every failing \cfunction{malloc()} call must be turned into an
227227
exception --- the direct caller of \cfunction{malloc()} (or
@@ -241,8 +241,8 @@ \section{Intermezzo: Errors and Exceptions
241241

242242
The choice of which exception to raise is entirely yours. There are
243243
predeclared C objects corresponding to all built-in Python exceptions,
244-
e.g.\ \cdata{PyExc_ZeroDivisionError}, which you can use directly. Of
245-
course, you should choose exceptions wisely --- don't use
244+
such as \cdata{PyExc_ZeroDivisionError}, which you can use directly.
245+
Of course, you should choose exceptions wisely --- don't use
246246
\cdata{PyExc_TypeError} to mean that a file couldn't be opened (that
247247
should probably be \cdata{PyExc_IOError}). If something's wrong with
248248
the argument list, the \cfunction{PyArg_ParseTuple()} function usually
@@ -252,14 +252,14 @@ \section{Intermezzo: Errors and Exceptions
252252

253253
You can also define a new exception that is unique to your module.
254254
For this, you usually declare a static object variable at the
255-
beginning of your file, e.g.
255+
beginning of your file:
256256

257257
\begin{verbatim}
258258
static PyObject *SpamError;
259259
\end{verbatim}
260260

261261
and initialize it in your module's initialization function
262-
(\cfunction{initspam()}) with an exception object, e.g.\ (leaving out
262+
(\cfunction{initspam()}) with an exception object (leaving out
263263
the error checking for now):
264264

265265
\begin{verbatim}
@@ -1316,7 +1316,7 @@ \subsection{Reference Counting in Python
13161316
A borrowed reference can be changed into an owned reference by calling
13171317
\cfunction{Py_INCREF()}. This does not affect the status of the owner from
13181318
which the reference was borrowed --- it creates a new owned reference,
1319-
and gives full owner responsibilities (i.e., the new owner must
1319+
and gives full owner responsibilities (the new owner must
13201320
dispose of the reference properly, as well as the previous owner).
13211321

13221322

@@ -1329,7 +1329,7 @@ \subsection{Ownership Rules
13291329

13301330
Most functions that return a reference to an object pass on ownership
13311331
with the reference. In particular, all functions whose function it is
1332-
to create a new object, e.g.\ \cfunction{PyInt_FromLong()} and
1332+
to create a new object, such as \cfunction{PyInt_FromLong()} and
13331333
\cfunction{Py_BuildValue()}, pass ownership to the receiver. Even if in
13341334
fact, in some cases, you don't receive a reference to a brand new
13351335
object, you still receive ownership of the reference. For instance,
@@ -1467,8 +1467,8 @@ \subsection{NULL Pointers
14671467
there would be a lot of redundant tests and the code would run more
14681468
slowly.
14691469

1470-
It is better to test for \NULL{} only at the ``source'', i.e.\ when a
1471-
pointer that may be \NULL{} is received, e.g.\ from
1470+
It is better to test for \NULL{} only at the ``source:'' when a
1471+
pointer that may be \NULL{} is received, for example, from
14721472
\cfunction{malloc()} or from a function that may raise an exception.
14731473

14741474
The macros \cfunction{Py_INCREF()} and \cfunction{Py_DECREF()}
@@ -1535,11 +1535,11 @@ \section{Providing a C API for an Extension Module
15351535
symbols defined in one module may not be visible to another module.
15361536
The details of visibility depend on the operating system; some systems
15371537
use one global namespace for the Python interpreter and all extension
1538-
modules (e.g.\ Windows), whereas others require an explicit list of
1539-
imported symbols at module link time (e.g.\ AIX), or offer a choice of
1540-
different strategies (most Unices). And even if symbols are globally
1541-
visible, the module whose functions one wishes to call might not have
1542-
been loaded yet!
1538+
modules (Windows, for example), whereas others require an explicit
1539+
list of imported symbols at module link time (AIX is one example), or
1540+
offer a choice of different strategies (most Unices). And even if
1541+
symbols are globally visible, the module whose functions one wishes to
1542+
call might not have been loaded yet!
15431543

15441544
Portability therefore requires not to make any assumptions about
15451545
symbol visibility. This means that all symbols in extension modules
@@ -1549,8 +1549,8 @@ \section{Providing a C API for an Extension Module
15491549
means that symbols that \emph{should} be accessible from other
15501550
extension modules must be exported in a different way.
15511551

1552-
Python provides a special mechanism to pass C-level information (i.e.
1553-
pointers) from one extension module to another one: CObjects.
1552+
Python provides a special mechanism to pass C-level information
1553+
(pointers) from one extension module to another one: CObjects.
15541554
A CObject is a Python data type which stores a pointer (\ctype{void
15551555
*}). CObjects can only be created and accessed via their C API, but
15561556
they can be passed around like any other Python object. In particular,
@@ -1904,7 +1904,7 @@ \section{The Basics
19041904
PyObject_New(<type>, &<type object>);
19051905
\end{verbatim}
19061906

1907-
This allocates the memory and then initializes the object (i.e.\ sets
1907+
This allocates the memory and then initializes the object (sets
19081908
the reference count to one, makes the \cdata{ob_type} pointer point at
19091909
the right place and maybe some other stuff, depending on build options).
19101910
You \emph{can} do these steps separately if you have some reason to

Doc/mac/libctb.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ \subsection{Connection Objects \label{connection-object}}
8585

8686
\begin{methoddesc}[connection]{Close}{timeout, now}
8787
Close a connection. When \var{now} is zero, the close is orderly
88-
(i.e.\ outstanding output is flushed, etc.)\ with a timeout of
88+
(outstanding output is flushed, etc.)\ with a timeout of
8989
\var{timeout} seconds. When \var{now} is non-zero the close is
9090
immediate, discarding output.
9191
\end{methoddesc}

0 commit comments

Comments
 (0)