[Python-checkins] python/nondist/sandbox/itertools libitertools.tex,1.17,1.18

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Wed, 29 Jan 2003 20:16:45 -0800


Update of /cvsroot/python/python/nondist/sandbox/itertools
In directory sc8-pr-cvs1:/tmp/cvs-serv2145

Modified Files:
	libitertools.tex 
Log Message:
Incorporated documentation fix-ups based on an excellent review
by Terry J. Reedy.



Index: libitertools.tex
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/itertools/libitertools.tex,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** libitertools.tex	30 Jan 2003 01:02:17 -0000	1.17
--- libitertools.tex	30 Jan 2003 04:16:43 -0000	1.18
***************
*** 91,101 ****
  
    \begin{verbatim}
!      def dropwhile(predicate, iterable, invert=False):
           iterable = iter(iterable)
           while True:
               x = iterable.next()
!              if not predicate(x):
!                  yield x
!                  break
           while True:
               yield iterable.next()
--- 91,101 ----
  
    \begin{verbatim}
!      def dropwhile(predicate, iterable):
           iterable = iter(iterable)
           while True:
               x = iterable.next()
!              if predicate(x): continue # drop when predicate is true
!              yield x
!              break
           while True:
               yield iterable.next()
***************
*** 129,135 ****
    each of the iterables.  If \var{function} is set to \code{None}, then
    \function{imap()} returns the arguments as a tuple.  Like
!   \function{map()} except that it returns an iterator instead of a
!   list and that it stops when the shortest iterable is exhausted
!   instead of filling in \code{None} for shorter iterables.
    Equivalent to:
  
--- 129,138 ----
    each of the iterables.  If \var{function} is set to \code{None}, then
    \function{imap()} returns the arguments as a tuple.  Like
!   \function{map()} but stops when the shortest iterable is exhausted
!   instead of filling in \code{None} for shorter iterables.  The reason
!   for the difference is that infinite iterator arguments are typically
!   an error for \function{map()} (because the output is fully evaluated)
!   but represent a common and useful way of supplying arguments to
!   \function{imap()}.
    Equivalent to:
  
***************
*** 230,234 ****
  
    \begin{verbatim}
!      def takewhile(predicate, iterable, invert=False):
           iterable = iter(iterable)
           while True:
--- 233,237 ----
  
    \begin{verbatim}
!      def takewhile(predicate, iterable):
           iterable = iter(iterable)
           while True: