Skip to content

Commit 4ea6619

Browse files
committed
Avoid overhead of islice.
1 parent c789e3c commit 4ea6619

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

toolz/itertoolz.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ def second(seq):
374374
>>> second('ABC')
375375
'B'
376376
"""
377-
return next(itertools.islice(seq, 1, None))
377+
seq = iter(seq)
378+
next(seq)
379+
return next(seq)
378380

379381

380382
def nth(n, seq):

0 commit comments

Comments
 (0)