Skip to content

Commit 37cdbeb

Browse files
author
James William Pye
committed
Rewrite interlace using map(next,cycle())
1 parent 7b9633e commit 37cdbeb

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

postgresql/python/itertools.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,4 @@ def interlace(*iters) -> collections.Iterable:
1919
i1-n, i2-n, ..., in-n,
2020
)
2121
"""
22-
iters = [iter(x) for x in iters]
23-
for i in cycle(range(len(iters))):
24-
yield next(iters[i])
22+
return map(next, cycle([iter(x) for x in iters]))

0 commit comments

Comments
 (0)