Modified itertools.izip() to match the behavior of __builtin__.zip()

which can now take zero arguments.
This commit is contained in:
Raymond Hettinger 2003-08-08 05:10:41 +00:00
parent 77fe69bd08
commit b5a420883c
4 changed files with 15 additions and 8 deletions

View file

@ -226,10 +226,13 @@ by functions or loops that truncate the stream.
\begin{verbatim}
def izip(*iterables):
iterables = map(iter, iterables)
while True:
while iterables:
result = [i.next() for i in iterables]
yield tuple(result)
\end{verbatim}
\versionchanged[When no iterables are specified, returns a zero length
iterator instead of raising a TypeError exception]{2.4}
\end{funcdesc}
\begin{funcdesc}{repeat}{object\optional{, times}}