[Python-checkins] python/nondist/sandbox/itertools libitertools.tex,1.2,1.3 todo.txt,1.2,1.3

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sun, 26 Jan 2003 17:35:23 -0800


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

Modified Files:
	libitertools.tex todo.txt 
Log Message:
Dropped cycle() from the todo list and documented the reasons.
Re-added starmap(), takewhile(), and dropwhile().



Index: libitertools.tex
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/itertools/libitertools.tex,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** libitertools.tex	27 Jan 2003 00:27:41 -0000	1.2
--- libitertools.tex	27 Jan 2003 01:35:20 -0000	1.3
***************
*** 27,30 ****
--- 27,42 ----
          \code{imap(\var{f}, count())} and produce an equivalent result.
  
+ 
+     \item Some tools were dropped because they offer no advantage over their
+         pure python counterparts or because their behavior was too
+         surprising.
+ 
+         For instance, SML provides a tool:  \code{cycle(\var{seq})} which
+         loops over the sequence elements and then starts again when the
+         sequence is exhausted.  The surprising behavior is the need for
+         significant auxilliary storage (unusual for iterators).  Also, it
+         is trivially implemented in python with almost no performance
+         penalty.
+ 
      \item Wherever straight-forward alternatives exist, the corresponding
          tools in this module seek to meet a different need and are designed

Index: todo.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/itertools/todo.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** todo.txt	27 Jan 2003 00:27:41 -0000	1.2
--- todo.txt	27 Jan 2003 01:35:21 -0000	1.3
***************
*** 1,7 ****
  Add:
     islice(iterator, start, stop, step)
-    cycle(seqn)
     imap(func, iter1, iter2, ...)
!    starmap(f, s) --> f(*(s1)), f(*(s2)) = [yield func(*args) for args in ia]
  
  Verify:
--- 1,9 ----
  Add:
     islice(iterator, start, stop, step)
     imap(func, iter1, iter2, ...)
!    iapply
!    starmap()
!    takewhile(pred, seqn)
!    dropwhile(pred, seqn)
  
  Verify:
***************
*** 9,12 ****
     refcounts
  
! Consider adding:
!    unzip() --> list of multiple iterator   ??? how would this work
--- 11,16 ----
     refcounts
  
! 
! Things dropped because they bug me:
!    cycle(seqn) requires auxilliary storage (which is surprising
!          behavior for iterators).  This is best left for pure python.