[Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.4,1.5
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 20 Feb 2003 17:45:37 -0800
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv9511
Modified Files:
libitertools.tex
Log Message:
Markup and nits.
Index: libitertools.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** libitertools.tex 11 Feb 2003 14:24:13 -0000 1.4
--- libitertools.tex 21 Feb 2003 01:45:34 -0000 1.5
***************
*** 19,30 ****
each with their own quirks and naming conventions.
! The tools are designed to combine readily with each another. This makes
it easy to construct more specialized tools succinctly and efficiently
in pure Python.
! For instance, SML provides a tabulation tool: \code{tabulate(\var{f})}
which produces a sequence \code{f(0), f(1), ...}. This toolbox
provides \function{imap()} and \function{count()} which can be combined
! to form \code{imap(\var{f}, count())} and produce an equivalent result.
Whether cast in pure python form or C code, tools that use iterators
--- 19,30 ----
each with their own quirks and naming conventions.
! The tools are designed to combine readily with one another. This makes
it easy to construct more specialized tools succinctly and efficiently
in pure Python.
! For instance, SML provides a tabulation tool: \code{tabulate(f)}
which produces a sequence \code{f(0), f(1), ...}. This toolbox
provides \function{imap()} and \function{count()} which can be combined
! to form \code{imap(f, count())} and produce an equivalent result.
Whether cast in pure python form or C code, tools that use iterators
***************
*** 76,83 ****
\begin{verbatim}
def count(n=0):
- cnt = n
while True:
! yield cnt
! cnt += 1
\end{verbatim}
--- 76,82 ----
\begin{verbatim}
def count(n=0):
while True:
! yield n
! n += 1
\end{verbatim}
***************
*** 209,222 ****
\end{funcdesc}
! \begin{funcdesc}{repeat}{obj}
! Make an iterator that returns \var{obj} over and over again.
Used as argument to \function{imap()} for invariant parameters
! to the called function. Also used with function{izip()} to create
an invariant part of a tuple record. Equivalent to:
\begin{verbatim}
! def repeat(x):
while True:
! yield x
\end{verbatim}
\end{funcdesc}
--- 208,221 ----
\end{funcdesc}
! \begin{funcdesc}{repeat}{object}
! Make an iterator that returns \var{object} over and over again.
Used as argument to \function{imap()} for invariant parameters
! to the called function. Also used with \function{izip()} to create
an invariant part of a tuple record. Equivalent to:
\begin{verbatim}
! def repeat(object):
while True:
! yield object
\end{verbatim}
\end{funcdesc}
***************
*** 227,231 ****
argument parameters are already grouped in tuples from a single iterable
(the data has been ``pre-zipped''). The difference between
! \function{imap()} and \function{starmap} parallels the distinction
between \code{function(a,b)} and \code{function(*c)}.
Equivalent to:
--- 226,230 ----
argument parameters are already grouped in tuples from a single iterable
(the data has been ``pre-zipped''). The difference between
! \function{imap()} and \function{starmap()} parallels the distinction
between \code{function(a,b)} and \code{function(*c)}.
Equivalent to: