mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merge
This commit is contained in:
commit
5d12faa5b8
2 changed files with 19 additions and 10 deletions
|
@ -1375,10 +1375,10 @@ are always available. They are listed here in alphabetical order.
|
|||
def zip(*iterables):
|
||||
# zip('ABCD', 'xy') --> Ax By
|
||||
sentinel = object()
|
||||
iterables = [iter(it) for it in iterables]
|
||||
while iterables:
|
||||
iterators = [iter(it) for it in iterables]
|
||||
while iterators:
|
||||
result = []
|
||||
for it in iterables:
|
||||
for it in iterators:
|
||||
elem = next(it, sentinel)
|
||||
if elem is sentinel:
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue