Saturday, 31 August 2013

Two simultaneous generator functions, Python

Two simultaneous generator functions, Python

I have two functions:
def a():
while True:
yield stuff
def b():
while True:
yield otherstuff
and I want to have a loop which collects one yield from each function
stored in a for a() and b for b() ; for example. If I nest the for loops
which call them, it restarts the 2nd generator every-time the first loop
loops. Can I have any help with this?
Thanks!

No comments:

Post a Comment