multirember&co

Anton Vredegoor anton.vredegoor at gmail.com
Fri Apr 20 18:23:17 CEST 2007


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.



More information about the Python-list mailing list