def split_on_condition(seq, condition):
l1, l2 = tee((condition(item), item) for item in seq)<EOL>return (i for p, i in l1 if p), (i for p, i in l2 if not p)<EOL>
Split a sequence into two iterables without looping twice