Skip to content

Commit

Permalink
Merge pull request #376 from groutr/faster_interpose
Browse files Browse the repository at this point in the history
A slightly faster interpose.
  • Loading branch information
eriknw committed Jul 4, 2017
2 parents 67ee1e6 + 80ba824 commit c3a6294
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions toolz/itertoolz.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,9 @@ def interpose(el, seq):
>>> list(interpose("a", [1, 2, 3]))
[1, 'a', 2, 'a', 3]
"""
combined = zip(itertools.repeat(el), seq)
return drop(1, concat(combined))
inposed = concat(zip(itertools.repeat(el), seq))
next(inposed)
return inposed


def frequencies(seq):
Expand Down

0 comments on commit c3a6294

Please sign in to comment.