multirember&co

A

Anton Vredegoor

Anton said:
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.
 
A

Anton Vredegoor

Anton said:
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)

This should be:

def xsplitter(seq, pred):
Q = deque(),deque()
it = iter(seq)
def gen(p):
for x in it:
Q[pred(x)].append(x)
while Q[p]: yield Q[p].popleft()
while Q[p]: yield Q[p].popleft()
return gen(1),gen(0)

But I'm still not sure if this is the desired function. Is it normal for
people to start replying to their own messages when they're studying
coroutines?

A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top