I have two generators, one which depends on the output of the other.
import asyncio
def do_work(n):
for i in range(n):
yield i
def more_work(x):
for i in x:
yield i * 2
def main():
x = do_work(5)
y = more_work(x)
for i, j in zip(x, y):
print(i, j)
if __name__ == "__main__":
main()
When I try to zip the inputs, it seems like Python is skipping some of the values of the control variables:
0 2
2 6
Does zip
continue iterating before both generators can yield at the same time?