def split_by(pred, seq):
"""
Splits start of sequence, consisting of items passing predicate, from the
rest of it. Works similar to takewhile(pred, seq), dropwhile(pred, seq),
but works with iterator seq correctly.
"""
a, b = _tee(seq)
return _takewhile(pred, a), _dropwhile(pred, b)
#
# Special iteration
#
评论列表
文章目录