[Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.8,1.9
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Fri, 02 May 2003 12:44:22 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv25408/Doc/lib
Modified Files:
libitertools.tex
Log Message:
The previous made the stop argument optional.
It is better to be explicit and just allow stop to be None.
Index: libitertools.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** libitertools.tex 2 May 2003 19:04:37 -0000 1.8
--- libitertools.tex 2 May 2003 19:44:20 -0000 1.9
***************
*** 198,204 ****
until start is reached. Afterward, elements are returned consecutively
unless \var{step} is set higher than one which results in items being
! skipped. If \var{stop} is not specified or is \code{None}, then iteration
! continues indefinitely; otherwise, it stops at the specified position.
! Unlike regular slicing,
\function{islice()} does not support negative values for \var{start},
\var{stop}, or \var{step}. Can be used to extract related fields
--- 198,204 ----
until start is reached. Afterward, elements are returned consecutively
unless \var{step} is set higher than one which results in items being
! skipped. If \var{stop} is \code{None}, then iteration continues until
! the iterator is exhausted, if at all; otherwise, it stops at the specified
! position. Unlike regular slicing,
\function{islice()} does not support negative values for \var{start},
\var{stop}, or \var{step}. Can be used to extract related fields
***************
*** 209,219 ****
\begin{verbatim}
def islice(iterable, *args):
! if args:
! s = slice(*args)
! next = s.start or 0
! stop = s.stop
! step = s.step or 1
! else:
! next, stop, step = 0, None, 1
for cnt, element in enumerate(iterable):
if cnt < next:
--- 209,216 ----
\begin{verbatim}
def islice(iterable, *args):
! s = slice(*args)
! next = s.start or 0
! stop = s.stop
! step = s.step or 1
for cnt, element in enumerate(iterable):
if cnt < next: