[Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.142,1.143

Fred L. Drake fdrake@users.sourceforge.net
Fri, 06 Jul 2001 10:28:41 -0700


Update of /cvsroot/python/python/dist/src/Doc/tut
In directory usw-pr-cvs1:/tmp/cvs-serv9280/tut

Modified Files:
	tut.tex 
Log Message:

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.


Index: tut.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v
retrieving revision 1.142
retrieving revision 1.143
diff -C2 -r1.142 -r1.143
*** tut.tex	2001/06/29 17:50:57	1.142
--- tut.tex	2001/07/06 17:28:39	1.143
***************
*** 243,247 ****
  \emph{secondary prompt}, by default three dots (\samp{...~}).
  The interpreter prints a welcome message stating its version number
! and a copyright notice before printing the first prompt, e.g.:
  
  \begin{verbatim}
--- 243,247 ----
  \emph{secondary prompt}, by default three dots (\samp{...~}).
  The interpreter prints a welcome message stating its version number
! and a copyright notice before printing the first prompt:
  
  \begin{verbatim}
***************
*** 326,331 ****
  
  If you want to read an additional start-up file from the current
! directory, you can program this in the global start-up file,
! e.g.\ \samp{if os.path.isfile('.pythonrc.py'):
  execfile('.pythonrc.py')}.  If you want to use the startup file in a
  script, you must do this explicitly in the script:
--- 326,331 ----
  
  If you want to read an additional start-up file from the current
! directory, you can program this in the global start-up file using code
! like \samp{if os.path.isfile('.pythonrc.py'):
  execfile('.pythonrc.py')}.  If you want to use the startup file in a
  script, you must do this explicitly in the script:
***************
*** 528,532 ****
  
  String literals can span multiple lines in several ways.  Newlines can
! be escaped with backslashes, e.g.:
  
  \begin{verbatim}
--- 528,532 ----
  
  String literals can span multiple lines in several ways.  Newlines can
! be escaped with backslashes:
  
  \begin{verbatim}
***************
*** 729,733 ****
  
  For non-negative indices, the length of a slice is the difference of
! the indices, if both are within bounds, e.g., the length of
  \code{word[1:3]} is 2.
  
--- 729,733 ----
  
  For non-negative indices, the length of a slice is the difference of
! the indices, if both are within bounds.  For example, the length of
  \code{word[1:3]} is 2.
  
***************
*** 800,805 ****
  \end{verbatim}
  
! The raw mode is most useful when you have to enter lots of backslashes
! e.g. in regular expressions.
  
  Apart from these standard encodings, Python provides a whole set of
--- 800,805 ----
  \end{verbatim}
  
! The raw mode is most useful when you have to enter lots of
! backslashes, as can be necessary in regular expressions.
  
  Apart from these standard encodings, Python provides a whole set of
***************
*** 1074,1078 ****
  halting condition (as C), Python's
  \keyword{for}\stindex{for} statement iterates over the items of any
! sequence (e.g., a list or a string), in the order that they appear in
  the sequence.  For example (no pun intended):
  % One suggestion was to give a real C example here, but that may only
--- 1074,1078 ----
  halting condition (as C), Python's
  \keyword{for}\stindex{for} statement iterates over the items of any
! sequence (a list or a string), in the order that they appear in
  the sequence.  For example (no pun intended):
  % One suggestion was to give a real C example here, but that may only
***************
*** 1091,1098 ****
  
  It is not safe to modify the sequence being iterated over in the loop
! (this can only happen for mutable sequence types, i.e., lists).  If
! you need to modify the list you are iterating over, e.g., duplicate
! selected items, you must iterate over a copy.  The slice notation
! makes this particularly convenient:
  
  \begin{verbatim}
--- 1091,1098 ----
  
  It is not safe to modify the sequence being iterated over in the loop
! (this can only happen for mutable sequence types, such as lists).  If
! you need to modify the list you are iterating over (for example, to
! duplicate selected items) you must iterate over a copy.  The slice
! notation makes this particularly convenient:
  
  \begin{verbatim}
***************
*** 1109,1113 ****
  If you do need to iterate over a sequence of numbers, the built-in
  function \function{range()} comes in handy.  It generates lists
! containing arithmetic progressions, e.g.:
  
  \begin{verbatim}
--- 1109,1113 ----
  If you do need to iterate over a sequence of numbers, the built-in
  function \function{range()} comes in handy.  It generates lists
! containing arithmetic progressions:
  
  \begin{verbatim}
***************
*** 1246,1250 ****
           Actually, \emph{call by object reference} would be a better
           description, since if a mutable object is passed, the caller
!          will see any changes the callee makes to it (e.g., items
           inserted into a list).
  } When a function calls another function, a new local symbol table is
--- 1246,1250 ----
           Actually, \emph{call by object reference} would be a better
           description, since if a mutable object is passed, the caller
!          will see any changes the callee makes to it (items
           inserted into a list).
  } When a function calls another function, a new local symbol table is
***************
*** 1332,1336 ****
  The most useful form is to specify a default value for one or more
  arguments.  This creates a function that can be called with fewer
! arguments than it is defined, e.g.
  
  \begin{verbatim}
--- 1332,1336 ----
  The most useful form is to specify a default value for one or more
  arguments.  This creates a function that can be called with fewer
! arguments than it is defined
  
  \begin{verbatim}
***************
*** 1350,1354 ****
  
  The default values are evaluated at the point of function definition
! in the \emph{defining} scope, so that e.g.
  
  \begin{verbatim}
--- 1350,1354 ----
  
  The default values are evaluated at the point of function definition
! in the \emph{defining} scope, so that
  
  \begin{verbatim}
***************
*** 1510,1514 ****
  function definition.  Like nested function definitions, lambda forms
  cannot reference variables from the containing scope, but this can be
! overcome through the judicious use of default argument values, e.g.
  
  \begin{verbatim}
--- 1510,1514 ----
  function definition.  Like nested function definitions, lambda forms
  cannot reference variables from the containing scope, but this can be
! overcome through the judicious use of default argument values:
  
  \begin{verbatim}
***************
*** 1854,1858 ****
  \section{Tuples and Sequences \label{tuples}}
  
! We saw that lists and strings have many common properties, e.g.,
  indexing and slicing operations.  They are two examples of
  \emph{sequence} data types.  Since Python is an evolving language,
--- 1854,1858 ----
  \section{Tuples and Sequences \label{tuples}}
  
! We saw that lists and strings have many common properties, such as
  indexing and slicing operations.  They are two examples of
  \emph{sequence} data types.  Since Python is an evolving language,
***************
*** 1880,1886 ****
  necessary anyway (if the tuple is part of a larger expression).
  
! Tuples have many uses, e.g., (x, y) coordinate pairs, employee records
! from a database, etc.  Tuples, like strings, are immutable: it is not
! possible to assign to the individual items of a tuple (you can
  simulate much of the same effect with slicing and concatenation,
  though).  It is also possible to create tuples which contain mutable
--- 1880,1886 ----
  necessary anyway (if the tuple is part of a larger expression).
  
! Tuples have many uses.  For example: (x, y) coordinate pairs, employee
! records from a database, etc.  Tuples, like strings, are immutable: it
! is not possible to assign to the individual items of a tuple (you can
  simulate much of the same effect with slicing and concatenation,
  though).  It is also possible to create tuples which contain mutable
***************
*** 1908,1912 ****
  \emph{tuple packing}: the values \code{12345}, \code{54321} and
  \code{'hello!'} are packed together in a tuple.  The reverse operation
! is also possible, e.g.:
  
  \begin{verbatim}
--- 1908,1912 ----
  \emph{tuple packing}: the values \code{12345}, \code{54321} and
  \code{'hello!'} are packed together in a tuple.  The reverse operation
! is also possible:
  
  \begin{verbatim}
***************
*** 1993,1998 ****
  operators.
  
! Comparisons can be chained: e.g., \code{a < b == c} tests whether
! \code{a} is less than \code{b} and moreover \code{b} equals \code{c}.
  
  Comparisons may be combined by the Boolean operators \code{and} and
--- 1993,1999 ----
  operators.
  
! Comparisons can be chained.  For example, \code{a < b == c} tests
! whether \code{a} is less than \code{b} and moreover \code{b} equals
! \code{c}.
  
  Comparisons may be combined by the Boolean operators \code{and} and
***************
*** 2199,2203 ****
  and then in the list of directories specified by
  the environment variable \envvar{PYTHONPATH}.  This has the same syntax as
! the shell variable \envvar{PATH}, i.e., a list of
  directory names.  When \envvar{PYTHONPATH} is not set, or when the file
  is not found there, the search continues in an installation-dependent
--- 2200,2204 ----
  and then in the list of directories specified by
  the environment variable \envvar{PYTHONPATH}.  This has the same syntax as
! the shell variable \envvar{PATH}, that is, a list of
  directory names.  When \envvar{PYTHONPATH} is not set, or when the file
  is not found there, the search continues in an installation-dependent
***************
*** 2290,2294 ****
  the core of the language but are nevertheless built in, either for
  efficiency or to provide access to operating system primitives such as
! system calls. The set of such modules is a configuration option; e.g.,
  the \module{amoeba} module is only provided on systems that somehow
  support Amoeba primitives.  One particular module deserves some
--- 2291,2296 ----
  the core of the language but are nevertheless built in, either for
  efficiency or to provide access to operating system primitives such as
! system calls.  The set of such modules is a configuration option which
! also dependson the underlying platform  For example,
  the \module{amoeba} module is only provided on systems that somehow
  support Amoeba primitives.  One particular module deserves some
***************
*** 2317,2321 ****
  path taken from the environment variable \envvar{PYTHONPATH}, or from
  a built-in default if \envvar{PYTHONPATH} is not set.  You can modify
! it using standard list operations, e.g.: 
  
  \begin{verbatim}
--- 2319,2323 ----
  path taken from the environment variable \envvar{PYTHONPATH}, or from
  a built-in default if \envvar{PYTHONPATH} is not set.  You can modify
! it using standard list operations: 
  
  \begin{verbatim}
***************
*** 2385,2397 ****
  the uniform handling of sound files and sound data.  There are many
  different sound file formats (usually recognized by their extension,
! e.g. \file{.wav}, \file{.aiff}, \file{.au}), so you may need to create
! and maintain a growing collection of modules for the conversion
! between the various file formats.  There are also many different
! operations you might want to perform on sound data (e.g. mixing,
! adding echo, applying an equalizer function, creating an artificial
! stereo effect), so in addition you will be writing a never-ending
! stream of modules to perform these operations.  Here's a possible
! structure for your package (expressed in terms of a hierarchical
! filesystem):
  
  \begin{verbatim}
--- 2387,2399 ----
  the uniform handling of sound files and sound data.  There are many
  different sound file formats (usually recognized by their extension,
! for example: \file{.wav}, \file{.aiff}, \file{.au}), so you may need
! to create and maintain a growing collection of modules for the
! conversion between the various file formats.  There are also many
! different operations you might want to perform on sound data (such as
! mixing, adding echo, applying an equalizer function, creating an
! artificial stereo effect), so in addition you will be writing a
! never-ending stream of modules to perform these operations.  Here's a
! possible structure for your package (expressed in terms of a
! hierarchical filesystem):
  
  \begin{verbatim}
***************
*** 2437,2441 ****
  
  This loads the submodule \module{Sound.Effects.echo}.  It must be referenced
! with its full name, e.g.
  
  \begin{verbatim}
--- 2439,2443 ----
  
  This loads the submodule \module{Sound.Effects.echo}.  It must be referenced
! with its full name.
  
  \begin{verbatim}
***************
*** 2524,2528 ****
  submodules explicitly loaded) by \file{__init__.py}.  It also includes any
  submodules of the package that were explicitly loaded by previous
! import statements, e.g.
  
  \begin{verbatim}
--- 2526,2530 ----
  submodules explicitly loaded) by \file{__init__.py}.  It also includes any
  submodules of the package that were explicitly loaded by previous
! import statements.  Consider this code:
  
  \begin{verbatim}
***************
*** 2704,2709 ****
  \end{verbatim}
  
! If there is more than one format in the string you pass a tuple as
! right operand, e.g.
  
  \begin{verbatim}
--- 2706,2711 ----
  \end{verbatim}
  
! If there is more than one format in the string, you need to pass a
! tuple as right operand, as in this example:
  
  \begin{verbatim}
***************
*** 2728,2732 ****
  up, it would be nice if you could reference the variables to be
  formatted by name instead of by position.  This can be done by using
! an extension of C formats using the form \code{\%(name)format}, e.g.
  
  \begin{verbatim}
--- 2730,2734 ----
  up, it would be nice if you could reference the variables to be
  formatted by name instead of by position.  This can be done by using
! form \code{\%(name)format}, as shown here:
  
  \begin{verbatim}
***************
*** 3043,3048 ****
  be executed.  Handlers only handle exceptions that occur in the
  corresponding try clause, not in other handlers of the same
! \keyword{try} statement. An except clause may name multiple exceptions
! as a parenthesized list, e.g.:
  
  \begin{verbatim}
--- 3045,3050 ----
  be executed.  Handlers only handle exceptions that occur in the
  corresponding try clause, not in other handlers of the same
! \keyword{try} statement.  An except clause may name multiple exceptions
! as a parenthesized list, for example:
  
  \begin{verbatim}
***************
*** 3311,3316 ****
  assignment to attributes is possible.  Module attributes are writable:
  you can write \samp{modname.the_answer = 42}.  Writable attributes may
! also be deleted with the \keyword{del} statement, e.g.
! \samp{del modname.the_answer}.
  
  Name spaces are created at different moments and have different
--- 3313,3319 ----
  assignment to attributes is possible.  Module attributes are writable:
  you can write \samp{modname.the_answer = 42}.  Writable attributes may
! also be deleted with the \keyword{del} statement.  For example,
! \samp{del modname.the_answer} will remove the attribute
! \member{the_answer} from the object named by \code{modname}.
  
  Name spaces are created at different moments and have different
***************
*** 3339,3343 ****
  Although scopes are determined statically, they are used dynamically.
  At any time during execution, exactly three nested scopes are in use
! (i.e., exactly three namespaces are directly accessible): the
  innermost scope, which is searched first, contains the local names,
  the middle scope, searched next, contains the current module's global
--- 3342,3346 ----
  Although scopes are determined statically, they are used dynamically.
  At any time during execution, exactly three nested scopes are in use
! (exactly three namespaces are directly accessible): the
  innermost scope, which is searched first, contains the local names,
  the middle scope, searched next, contains the current module's global
***************
*** 3513,3517 ****
  are \emph{methods}.  A method is a function that ``belongs to'' an
  object.  (In Python, the term method is not unique to class instances:
! other object types can have methods as well, e.g., list objects have
  methods called append, insert, remove, sort, and so on.  However,
  below, we'll use the term method exclusively to mean methods of class
--- 3516,3520 ----
  are \emph{methods}.  A method is a function that ``belongs to'' an
  object.  (In Python, the term method is not unique to class instances:
! other object types can have methods as well.  For example, list objects have
  methods called append, insert, remove, sort, and so on.  However,
  below, we'll use the term method exclusively to mean methods of class
***************
*** 3530,3534 ****
  \subsection{Method Objects \label{methodObjects}}
  
! Usually, a method is called immediately, e.g.:
  
  \begin{verbatim}
--- 3533,3537 ----
  \subsection{Method Objects \label{methodObjects}}
  
! Usually, a method is called immediately:
  
  \begin{verbatim}
***************
*** 3584,3590 ****
  avoid accidental name conflicts, which may cause hard-to-find bugs in
  large programs, it is wise to use some kind of convention that
! minimizes the chance of conflicts, e.g., capitalize method names,
! prefix data attribute names with a small unique string (perhaps just
! an underscore), or use verbs for methods and nouns for data attributes.
  
  
--- 3587,3594 ----
  avoid accidental name conflicts, which may cause hard-to-find bugs in
  large programs, it is wise to use some kind of convention that
! minimizes the chance of conflicts.  Possible conventions include
! capitalizing method names, prefixing data attribute names with a small
! unique string (perhaps just an underscore), or using verbs for methods
! and nouns for data attributes.
  
  
***************
*** 3648,3652 ****
  
  Methods may call other methods by using method attributes of the
! \code{self} argument, e.g.:
  
  \begin{verbatim}
--- 3652,3656 ----
  
  Methods may call other methods by using method attributes of the
! \code{self} argument:
  
  \begin{verbatim}
***************
*** 3691,3695 ****
  the derived class definition.  Instead of a base class name, an
  expression is also allowed.  This is useful when the base class is
! defined in another module, e.g.,
  
  \begin{verbatim}
--- 3695,3699 ----
  the derived class definition.  Instead of a base class name, an
  expression is also allowed.  This is useful when the base class is
! defined in another module,
  
  \begin{verbatim}
***************
*** 3786,3793 ****
  rules are designed mostly to avoid accidents; it still is possible for
  a determined soul to access or modify a variable that is considered
! private.  This can even be useful, e.g. for the debugger, and that's
! one reason why this loophole is not closed.  (Buglet: derivation of a
! class with the same name as the base class makes use of private
! variables of the base class possible.)
  
  Notice that code passed to \code{exec}, \code{eval()} or
--- 3790,3797 ----
  rules are designed mostly to avoid accidents; it still is possible for
  a determined soul to access or modify a variable that is considered
! private.  This can even be useful in special circumstances, such as in
! the debugger, and that's one reason why this loophole is not closed.
! (Buglet: derivation of a class with the same name as the base class
! makes use of private variables of the base class possible.)
  
  Notice that code passed to \code{exec}, \code{eval()} or
***************
*** 3825,3829 ****
  Sometimes it is useful to have a data type similar to the Pascal
  ``record'' or C ``struct'', bundling together a couple of named data
! items.  An empty class definition will do nicely, e.g.:
  
  \begin{verbatim}
--- 3829,3833 ----
  Sometimes it is useful to have a data type similar to the Pascal
  ``record'' or C ``struct'', bundling together a couple of named data
! items.  An empty class definition will do nicely:
  
  \begin{verbatim}