[Python-checkins] python/dist/src/Doc/tut glossary.tex,1.5,1.6
montanaro at users.sourceforge.net
montanaro at users.sourceforge.net
Sat Mar 27 13:23:13 EST 2004
Update of /cvsroot/python/python/dist/src/Doc/tut
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14413
Modified Files:
glossary.tex
Log Message:
- add entry for complex number
- fix a couple typos
- refine definitions for "interpreted" and "coercion" based upon updates on
the python glossary wiki
Index: glossary.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glossary.tex 28 Sep 2003 19:03:36 -0000 1.5
--- glossary.tex 27 Mar 2004 18:23:11 -0000 1.6
***************
*** 38,48 ****
\index{coercion}
\item[coercion]
! Converting data from one type to another. For example,
! {}\code{int(3.15)} coerces the floating point number to the integer,
! {}\code{3}. Most mathematical operations have rules for coercing
! their arguments to a common type. For instance, adding \code{3+4.5},
! causes the integer \code{3} to be coerced to be a float
! {}\code{3.0} before adding to \code{4.5} resulting in the float
! {}\code{7.5}.
\index{descriptor}
--- 38,68 ----
\index{coercion}
\item[coercion]
!
! The implicit conversion of an instance of one type to another during an
! operation which involves two arguments of the same type. For example,
! {}\code{int(3.15)} converts the floating point number to the integer,
! {}\code{3}, but in {}\code{3+4.5}, each argument is of a different type (one
! int, one float), and both must be converted to the same type before they can
! be added or it will raise a {}\code{TypeError}. Coercion between two
! operands can be performed with the {}\code{coerce} builtin function; thus,
! {}\code{3+4.5} is equivalent to calling {}\code{operator.add(*coerce(3,
! 4.5))} and results in {}\code{operator.add(3.0, 4.5)}. Without coercion,
! all arguments of even compatible types would have to be normalized to the
! same value by the programmer, e.g., {}\code{float(3)+4.5} rather than just
! {}\code{3+4.5}.
!
! \index{complex number}
! \item[complex number]
!
! An extension of the familiar real number system in which all numbers are
! expressed as a sum of a real part and an imaginary part. Imaginary numbers
! are real multiples of the imaginary unit (the square root of {}\code{-1}),
! often written {}\code{i} in mathematics or {}\code{j} in engineering.
! Python has builtin support for complex numbers, which are written with this
! latter notation; the imaginary part is written with a {}\code{j} suffix,
! e.g., {}\code{3+1j}. To get access to complex equivalents of the
! {}\module{math} module, use {}\module{cmath}. Use of complex numbers is a
! fairy advanced mathematical feature. If you're not aware of a need for it's
! almost certain you can safely ignore them.
\index{descriptor}
***************
*** 100,111 ****
\index{generator}
\item[generator]
! A function that returns an iterator. It looks like a normal function
! except that the \keyword{yield} keyword is used instead of
! {}\keyword{return}. Generator functions often contain one or more
! {}\keyword{for} or \keyword{while} loops that \keyword{yield} elements
! back to the caller. The function execution is stopped at the
! {}\keyword{yield} keyword (returning the result) and is resumed there
! when the next element is requested by calling the \method{next()}
! method of the returned iterator.
\index{GIL}
--- 120,131 ----
\index{generator}
\item[generator]
! A function that returns an iterator. It looks like a normal function except
! that values are returned to the caller using a \keyword{yield} statement
! instead of a {}\keyword{return} statement. Generator functions often
! contain one or more {}\keyword{for} or \keyword{while} loops that
! \keyword{yield} elements back to the caller. The function execution is
! stopped at the {}\keyword{yield} keyword (returning the result) and is
! resumed there when the next element is requested by calling the
! \method{next()} method of the returned iterator.
\index{GIL}
***************
*** 135,139 ****
\index{immutable}
\item[immutable]
! A object with fixed value. Immutable objects are numbers, strings or
tuples (and more). Such an object cannot be altered. A new object
has to be created if a different value has to be stored. They play an
--- 155,159 ----
\index{immutable}
\item[immutable]
! An object with fixed value. Immutable objects are numbers, strings or
tuples (and more). Such an object cannot be altered. A new object
has to be created if a different value has to be stored. They play an
***************
*** 150,154 ****
However, if one of the operands is another numeric type (such as a
{}\class{float}), the result will be coerced (see \emph{coercion}) to
! a common type. For example, a integer divided by a float will result
in a float value, possibly with a decimal fraction. Integer division
can be forced by using the \code{//} operator instead of the \code{/}
--- 170,174 ----
However, if one of the operands is another numeric type (such as a
{}\class{float}), the result will be coerced (see \emph{coercion}) to
! a common type. For example, an integer divided by a float will result
in a float value, possibly with a decimal fraction. Integer division
can be forced by using the \code{//} operator instead of the \code{/}
***************
*** 165,173 ****
\index{interpreted}
\item[interpreted]
! Python is an interpreted language, opposed to a compiled one. This
! means that the source files can be run right away without first making
! an executable which is then run. Interpreted languages typically have
! a shorter development/debug cycle than compiled ones. See also
! {}\emph{interactive}.
\index{iterable}
--- 185,193 ----
\index{interpreted}
\item[interpreted]
! Python is an interpreted language, as opposed to a compiled one. This means
! that the source files can be run directly without first creating an
! executable which is then run. Interpreted languages typically have a
! shorter development/debug cycle than compiled ones, though their programs
! generally also run more slowly. See also {}\emph{interactive}.
\index{iterable}
More information about the Python-checkins
mailing list