Skip to content

Commit 80ba824

Browse files
committed
A slightly faster interposed.
Replace the call to islice with a call to next().
1 parent 67ee1e6 commit 80ba824

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

toolz/itertoolz.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,9 @@ def interpose(el, seq):
520520
>>> list(interpose("a", [1, 2, 3]))
521521
[1, 'a', 2, 'a', 3]
522522
"""
523-
combined = zip(itertools.repeat(el), seq)
524-
return drop(1, concat(combined))
523+
inposed = concat(zip(itertools.repeat(el), seq))
524+
next(inposed)
525+
return inposed
525526

526527

527528
def frequencies(seq):

0 commit comments

Comments
 (0)