Anton Vredegoor wrote: > What's up here? Was it a fata morgana? Am I overlooking something? Even more crazy version: def xsplitter(seq, pred): Q = deque(),deque() it = iter(seq) def gen(p): for x in it: Q[pred(x) == p].append(x) while Q[p]: yield Q[p].popleft() while Q[p]: yield Q[p].popleft() return gen(1),gen(0) A.