mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
This commit is contained in:
parent
77fe69bd08
commit
b5a420883c
4 changed files with 15 additions and 8 deletions
|
@ -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}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue