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

Skip to content

Commit 3f20592

Browse files
committed
Consistency:
"Unix" ==> "\UNIX{}" "C" ==> "\C{}" "C++" ==> "\Cpp{}"
1 parent b25c0e7 commit 3f20592

2 files changed

Lines changed: 68 additions & 68 deletions

File tree

Doc/tut.tex

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
and additional documentation.
3838

3939
The Python interpreter is easily extended with new functions and data
40-
types implemented in C or C++ (or other languages callable from C).
40+
types implemented in \C{} or \Cpp{} (or other languages callable from \C{}).
4141
Python is also suitable as an extension language for customizable
4242
applications.
4343

@@ -49,8 +49,8 @@
4949
For a description of standard objects and modules, see the
5050
\emph{Python Library Reference} document. The \emph{Python Reference
5151
Manual} gives a more formal definition of the language. To write
52-
extensions in C or C++, read the \emph{Extending and Embedding} and
53-
\emph{Python/C API} manuals. There are also several books covering
52+
extensions in \C{} or \Cpp{}, read the \emph{Extending and Embedding} and
53+
\emph{Python/\C{} API} manuals. There are also several books covering
5454
Python in depth.
5555

5656
This tutorial does not attempt to be comprehensive and cover every
@@ -75,15 +75,15 @@ \section{Introduction}
7575
If you ever wrote a large shell script, you probably know this
7676
feeling: you'd love to add yet another feature, but it's already so
7777
slow, and so big, and so complicated; or the feature involves a system
78-
call or other function that is only accessible from C \ldots Usually
78+
call or other function that is only accessible from \C{} \ldots Usually
7979
the problem at hand isn't serious enough to warrant rewriting the
80-
script in C; perhaps the problem requires variable-length strings or
80+
script in \C{}; perhaps the problem requires variable-length strings or
8181
other data types (like sorted lists of file names) that are easy in
82-
the shell but lots of work to implement in C, or perhaps you're not
83-
sufficiently familiar with C.
82+
the shell but lots of work to implement in \C{}, or perhaps you're not
83+
sufficiently familiar with \C{}.
8484

85-
Another situation: perhaps you have to work with several C libraries,
86-
and the usual C write/compile/test/re-compile cycle is too slow. You
85+
Another situation: perhaps you have to work with several \C{} libraries,
86+
and the usual \C{} write/compile/test/re-compile cycle is too slow. You
8787
need to develop software more quickly. Possibly perhaps you've
8888
written a program that could use an extension language, and you don't
8989
want to design a language, write and debug an interpreter for it, then
@@ -92,10 +92,10 @@ \section{Introduction}
9292
In such cases, Python may be just the language for you. Python is
9393
simple to use, but it is a real programming language, offering much
9494
more structure and support for large programs than the shell has. On
95-
the other hand, it also offers much more error checking than C, and,
95+
the other hand, it also offers much more error checking than \C{}, and,
9696
being a \emph{very-high-level language}, it has high-level data types
9797
built in, such as flexible arrays and dictionaries that would cost you
98-
days to implement efficiently in C. Because of its more general data
98+
days to implement efficiently in \C{}. Because of its more general data
9999
types Python is applicable to a much larger problem domain than
100100
\emph{Awk} or even \emph{Perl}, yet many things are at least as easy
101101
in Python as in those languages.
@@ -115,7 +115,7 @@ \section{Introduction}
115115
It is also a handy desk calculator.
116116

117117
Python allows writing very compact and readable programs. Programs
118-
written in Python are typically much shorter than equivalent C
118+
written in Python are typically much shorter than equivalent \C{}
119119
programs, for several reasons:
120120
\begin{itemize}
121121
\item
@@ -128,12 +128,12 @@ \section{Introduction}
128128
no variable or argument declarations are necessary.
129129
\end{itemize}
130130

131-
Python is \emph{extensible}: if you know how to program in C it is easy
131+
Python is \emph{extensible}: if you know how to program in \C{} it is easy
132132
to add a new built-in function or module to the interpreter, either to
133133
perform critical operations at maximum speed, or to link Python
134134
programs to libraries that may only be available in binary form (such
135135
as a vendor-specific graphics library). Once you are really hooked,
136-
you can link the Python interpreter into an application written in C
136+
you can link the Python interpreter into an application written in \C{}
137137
and use it as an extension or command language for that application.
138138

139139
By the way, the language is named after the BBC show ``Monty Python's
@@ -182,7 +182,7 @@ \section{Invoking the Interpreter}
182182
sys.exit()}.
183183

184184
The interpreter's line-editing features usually aren't very
185-
sophisticated. On Unix, whoever installed the interpreter may have
185+
sophisticated. On \UNIX{}, whoever installed the interpreter may have
186186
enabled support for the GNU readline library, which adds more
187187
elaborate interactive editing and history features. Perhaps the
188188
quickest check to see whether command line editing is supported is
@@ -343,7 +343,7 @@ \subsection{Numbers}
343343
The interpreter acts as a simple calculator: you can type an
344344
expression at it and it will write the value. Expression syntax is
345345
straightforward: the operators \code{+}, \code{-}, \code{*} and \code{/}
346-
work just like in most other languages (e.g., Pascal or C); parentheses
346+
work just like in most other languages (e.g., Pascal or \C{}); parentheses
347347
can be used for grouping. For example:
348348

349349
\bcode\begin{verbatim}
@@ -364,7 +364,7 @@ \subsection{Numbers}
364364
>>>
365365
\end{verbatim}\ecode
366366
%
367-
Like in C, the equal sign (\code{=}) is used to assign a value to a
367+
Like in \C{}, the equal sign (\code{=}) is used to assign a value to a
368368
variable. The value of an assignment is not written:
369369

370370
\bcode\begin{verbatim}
@@ -550,7 +550,7 @@ \subsection{Strings}
550550
the first line above could also have been written \code{word = 'Help'
551551
'A'}; this only works with two literals, not with arbitrary string expressions.
552552

553-
Strings can be subscripted (indexed); like in C, the first character
553+
Strings can be subscripted (indexed); like in \C{}, the first character
554554
of a string has subscript (index) 0. There is no separate character
555555
type; a character is simply a string of size one. Like in Icon,
556556
substrings can be specified with the \emph{slice} notation: two indices
@@ -805,12 +805,12 @@ \section{First Steps Towards Programming}
805805

806806
\item
807807
The \code{while} loop executes as long as the condition (here: \code{b <
808-
10}) remains true. In Python, like in C, any non-zero integer value is
808+
10}) remains true. In Python, like in \C{}, any non-zero integer value is
809809
true; zero is false. The condition may also be a string or list value,
810810
in fact any sequence; anything with a non-zero length is true, empty
811811
sequences are false. The test used in the example is a simple
812812
comparison. The standard comparison operators are written the same as
813-
in C: \code{<}, \code{>}, \code{==}, \code{<=}, \code{>=} and \code{!=}.
813+
in \C{}: \code{<}, \code{>}, \code{==}, \code{<=}, \code{>=} and \code{!=}.
814814

815815
\item
816816
The \emph{body} of the loop is \emph{indented}: indentation is Python's
@@ -889,9 +889,9 @@ \section{If Statements}
889889
\section{For Statements}
890890

891891
The \code{for} statement in Python differs a bit from what you may be
892-
used to in C or Pascal. Rather than always iterating over an
892+
used to in \C{} or Pascal. Rather than always iterating over an
893893
arithmetic progression of numbers (like in Pascal), or leaving the user
894-
completely free in the iteration test and step (as C), Python's
894+
completely free in the iteration test and step (as \C{}), Python's
895895
\code{for} statement iterates over the items of any sequence (e.g., a
896896
list or a string), in the order that they appear in the sequence. For
897897
example (no pun intended):
@@ -968,10 +968,10 @@ \section{The \sectcode{range()} Function}
968968

969969
\section{Break and Continue Statements, and Else Clauses on Loops}
970970

971-
The \code{break} statement, like in C, breaks out of the smallest
971+
The \code{break} statement, like in \C{}, breaks out of the smallest
972972
enclosing \code{for} or \code{while} loop.
973973

974-
The \code{continue} statement, also borrowed from C, continues with the
974+
The \code{continue} statement, also borrowed from \C{}, continues with the
975975
next iteration of the loop.
976976

977977
Loop statements may have an \code{else} clause; it is executed when the
@@ -1084,7 +1084,7 @@ \section{Defining Functions}
10841084
\end{verbatim}\ecode
10851085
%
10861086
You might object that \code{fib} is not a function but a procedure. In
1087-
Python, like in C, procedures are just functions that don't return a
1087+
Python, like in \C{}, procedures are just functions that don't return a
10881088
value. In fact, technically speaking, procedures do return a value,
10891089
albeit a rather boring one. This value is called \code{None} (it's a
10901090
built-in name). Writing the value \code{None} is normally suppressed by
@@ -1624,7 +1624,7 @@ \section{More on Conditions}
16241624
>>>
16251625
\end{verbatim}\ecode
16261626
%
1627-
Note that in Python, unlike C, assignment cannot occur inside expressions.
1627+
Note that in Python, unlike \C{}, assignment cannot occur inside expressions.
16281628

16291629
\section{Comparing Sequences and Other Types}
16301630

@@ -2075,18 +2075,18 @@ \section{Fancier Output Formatting}
20752075
>>>
20762076
\end{verbatim}
20772077
2078-
Most formats work exactly as in C and require that you pass the proper
2078+
Most formats work exactly as in \C{} and require that you pass the proper
20792079
type; however, if you don't you get an exception, not a core dump.
20802080
The \verb\%s\ format is more relaxed: if the corresponding argument is
20812081
not a string object, it is converted to string using the \verb\str()\
20822082
built-in function. Using \verb\*\ to pass the width or precision in
2083-
as a separate (integer) argument is supported. The C formats
2083+
as a separate (integer) argument is supported. The \C{} formats
20842084
\verb\%n\ and \verb\%p\ are not supported.
20852085
20862086
If you have a really long format string that you don't want to split
20872087
up, it would be nice if you could reference the variables to be
20882088
formatted by name instead of by position. This can be done by using
2089-
an extension of C formats using the form \verb\%(name)format\, e.g.
2089+
an extension of \C{} formats using the form \verb\%(name)format\, e.g.
20902090
20912091
\begin{verbatim}
20922092
>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
@@ -2895,9 +2895,9 @@ \section{Random remarks}
28952895
usable to implement pure abstract data types. In fact, nothing in
28962896
Python makes it possible to enforce data hiding --- it is all based
28972897
upon convention. (On the other hand, the Python implementation,
2898-
written in C, can completely hide implementation details and control
2898+
written in \C{}, can completely hide implementation details and control
28992899
access to an object if necessary; this can be used by extensions to
2900-
Python written in C.)
2900+
Python written in \C{}.)
29012901
29022902
29032903
Clients should use data attributes with care --- clients may mess up
@@ -3174,7 +3174,7 @@ \section{Private variables through name mangling}
31743174
\section{Odds and ends}
31753175
31763176
Sometimes it is useful to have a data type similar to the Pascal
3177-
``record'' or C ``struct'', bundling together a couple of named data
3177+
``record'' or \C{} ``struct'', bundling together a couple of named data
31783178
items. An empty class definition will do nicely, e.g.:
31793179
31803180
\begin{verbatim}
@@ -3274,8 +3274,8 @@ \chapter{What Now?}
32743274
which gives complete (though terse) reference material about types,
32753275
functions, and modules that can save you a lot of time when writing
32763276
Python programs. The standard Python distribution includes a
3277-
\emph{lot} of code in both C and Python; there are modules to read
3278-
Unix mailboxes, retrieve documents via HTTP, generate random numbers,
3277+
\emph{lot} of code in both \C{} and Python; there are modules to read
3278+
\UNIX{} mailboxes, retrieve documents via HTTP, generate random numbers,
32793279
parse command-line options, write CGI programs, compress data, and a
32803280
lot more; skimming through the Library Reference will give you an idea
32813281
of what's available.

0 commit comments

Comments
 (0)